Skip to content

Commit dc45138

Browse files
authored
admin: Document my git-cliff workflow for release notes (#4319)
For the last year or so, I have been using git-cliff to generate the first draft of release notes. It gets me 90% of the way there for the monthly patch releases, perhaps more like 30% (but a very good starting point) for the big annual major releases. In this PR, I document my process and check in the toml file that provides the git cliff configuration that gets mostly what we need. Signed-off-by: Larry Gritz <lg@larrygritz.com>
1 parent 979e5f9 commit dc45138

File tree

8 files changed

+361
-1
lines changed

8 files changed

+361
-1
lines changed

.github/workflows/analysis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ on:
1616
- master
1717
- '*analysis*'
1818
- '*sonar*'
19+
paths-ignore:
20+
- '**.md'
21+
- '**.rst'
22+
- 'docs/**'
1923
# Allow manual kicking off of the workflow from github.com
2024
workflow_dispatch:
2125
# Uncomment the following line if we want to run analysis on all PRs:

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ on:
1212
- '**.rst'
1313
- '**.analysis.yml'
1414
- '**.properties'
15+
- 'docs/**'
1516
pull_request:
1617
paths-ignore:
1718
- '**.md'
1819
- '**.rst'
20+
- 'docs/**'
1921
schedule:
2022
# Full nightly build
2123
- cron: "0 8 * * *"

.github/workflows/scorecard.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,18 @@ on:
1111
# Run on pushes to master, but only the main repo, not forks
1212
branches: [ "master" ]
1313
if: github.event.pull_request.head.repo.full_name == github.repository
14+
paths-ignore:
15+
- '**.md'
16+
- '**.rst'
17+
- 'docs/**'
1418
pull_request:
1519
# Only run on individual PRs if the workflow file itself is changed.
1620
paths:
1721
- .github/workflows/scorecard.yml
22+
paths-ignore:
23+
- '**.md'
24+
- '**.rst'
25+
- 'docs/**'
1826

1927
# Declare default permissions as read only.
2028
permissions: read-all

CONTRIBUTING.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,84 @@ leverage this [command line tool](https://github.com/coderanger/dco) for
147147
automatically adding the signoff message on commits.
148148

149149

150+
Commit messages
151+
---------------
152+
153+
### Summary heuristic
154+
155+
Look at the commit history of the project to get a sense of the style and
156+
level of detail that is expected in commit messages.
157+
158+
### General guidelines and expectations
159+
160+
The first line of the commit message should be a short (less than 80
161+
characters) summary of the change, prefixed with the general nature of the
162+
change (see below).
163+
164+
The rest of the commit message should be a more detailed explanation of the
165+
changes. Some commits are self-explanatory and don't need more than the
166+
summary line. Others may need a more detailed explanation. Hallmarks of
167+
a good commit message include:
168+
169+
* An explanation of why the change is necessary and what you hope to
170+
accomplish with it.
171+
* A description of any major user- or developer-facing changes that people
172+
should be aware of: changes in APIs or behaviors, new features, etc.
173+
* An explanation of any tricky implementation details or design decisions that
174+
might not be immediately obvious to someone reading the code.
175+
* Guideposts for somebody reviewing the code to understand the rationale and
176+
have any supporting background information to fully understanding the code
177+
changes.
178+
179+
Remember that at some point in the future, a developer unfamiliar with your
180+
change (maybe you, long after you've forgotten the details) might need to
181+
understand or fix your patch. Keep that person in mind as your audience and
182+
strive to write a commit message that explains the context in a way that saves
183+
them time and effort. Be the hero in the story of their future debugging
184+
effort!
185+
186+
### Using "conventional commits" prefixes
187+
188+
We strive to follow the recommendations known as [conventional
189+
commits](https://www.conventionalcommits.org/), which means that we would like
190+
merged commit messages to have their first line start with one of the
191+
following prefixes:
192+
193+
- `feat:` new features
194+
- `fix:` bug fixes
195+
- `perf:` performance improvements
196+
- `api:` changes to the public APIs
197+
- `int:` changes to code internals that don't affect the public API
198+
- `build:` changes to the build system
199+
- `test:` changes to the test suite or unit tests
200+
- `ci:` changes to the CI system
201+
- `docs:` changes to the documentation
202+
- `refactor:` code refactoring
203+
- `style:` formatting or other stylistic non-functional changes to the code
204+
- `admin:` project administration or policy changes
205+
- `revert:` reverting a previous commit
206+
207+
Obviously, some (if not most) PRs may qualify for more than one of these
208+
categories (for example, a new feature may also introduce a new API call, add
209+
tests, and include new documentation). If that is the case, use your best
210+
judgment to pick the category that best captures the essence or most important
211+
aspect of the change. When ambiguous, consider the list above to be a priority
212+
ranking (e.g., a change that fixes a bug and adds a new test should be listed
213+
under `fix:`, because that appears first in the list).
214+
215+
It is also encouraged, when it makes sense to do so, to put a subcategory in
216+
parenthesis after the prefix, like `fix(exr):` or `feat(IBA):`. It's ok to use
217+
obvious abbreviations for major classes or subsections: IB=ImageBuf,
218+
IBA=ImageBufAlgo, IC=ImageCace, TS=TextureSystem, etc. If there is no clear
219+
single format or class that is the man focus of the patch, then you can omit
220+
the subcategory.
221+
222+
API or ABI-breaking changes should additionally be marked with an exclamation
223+
point at the end of the prefix, like `feat!:` or `api!:` to make it easily
224+
identifiable as a breaking change from the first line of the commit message.
225+
226+
227+
150228
Pull Requests and Code Review
151229
-----------------------------
152230

RELEASING.md

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ The following are the steps for making the release:
241241

242242
2. Edit CHANGES.md to reflect the correct date of the release and ensure it
243243
includes any last-minute changes that were made during beta or release
244-
candidate stages.
244+
candidate stages. Please see the section "Generating release notes" below.
245245

246246
3. Push it to **your** GitHub, make sure it passes CI.
247247

@@ -352,3 +352,86 @@ Odds and ends to do after the tag is pushed and the announcements are sent:
352352
(blank) heading for the next patch or release.
353353

354354

355+
## Generating release notes
356+
357+
We strongly encourage the use of "conventional commit" prefixes in commit
358+
messages. See [CONTRIBUTING.md](CONTRIBUTING.md#commit-messages) for details.
359+
360+
Many PRs are submitted (even by the author of this section you are now
361+
reading!) without the conventional commit prefix. The person who approves and
362+
merges the commit should take responsibility during the merge process to edit
363+
the commit message to add the appropriate prefix (and for that matter, to edit
364+
any part of the commit message for clarity). But at the end of the day, if we
365+
end up with some commits lacking a conventional commit prefix, it's no big
366+
deal -- we can fix it all up by hand when we make the release notes. But
367+
having CC prefixes in as many commit messages possible helps make the release
368+
notes process be simpler and more automated.
369+
370+
We have been using the [git-cliff](https://github.com/orhun/git-cliff) tool
371+
as the starting point for relese notes. The command we use is:
372+
373+
git cliff -c src/doc/cliff.toml -d v1.2.3.4..HEAD > cliff.out.md
374+
375+
where v1.2.3.4 in this example is the tag of the last release. You could also
376+
use commit hashes to denote the range of changes you want to document.
377+
378+
**For monthly patch releases**
379+
380+
We have found that the git-cliff output is most of what we need for the patch
381+
releases, and can be copied into the CHANGES.md file with only some minor
382+
editing needed. The template for the patch release notes can be found in
383+
[Changes-skeleton-patch.md](docs/dev/Changes-skeleton-patch.md).
384+
385+
* Get rid of the headings that git-cliff generates. We don't use the headings
386+
for the patch releases.
387+
* Add prefixes to any commits that don't have them (they will be marked as
388+
"uncategorized" by git-cliff), and feel free to change any of the existing
389+
prefixes that you think are wrong or could be improved for clarity.
390+
* Rearrange the order of the entries to be logical and readable. I prefer the
391+
order: feature enhancements, bug fixes, build system fixes that might impact
392+
users, internal changes, test improvements, documentation and administrative
393+
changes.
394+
* For patch releases, feel free to omit any entries that you think are not
395+
user-facing and are too minor to be worth mentioning in the release notes.
396+
397+
Strive to keep the release notes just long enough for users to know if the
398+
patch contains any fixes relevant to them, but short enough to be read at a
399+
glance and without extraneous detail.
400+
401+
Here is an example of well-constructed monthly patch release notes:
402+
https://github.com/AcademySoftwareFoundation/OpenImageIO/releases/tag/v2.5.12.0
403+
404+
**For annual major/minor releases**
405+
406+
For major releases, the git-cliff output is just a starting point and need
407+
significant editing to get the detail and quality level we expect for our
408+
major releases. A simple bullet list of commits is not sufficient -- we aim
409+
for a prose-based description of important changes that "tell the story" of
410+
the year's work and will be thoroughly understood by our stakeholders who need
411+
to understand what has changed.
412+
413+
* Copy all the headings from [Changes-skeleton-major.md](docs/dev/Changes-skeleton-major.md)
414+
or the previous year's release notes to get the skeleton of the major and
415+
minor headers that you fit everything into. Note that it mostly corresponds
416+
to sections of the git-cliff output, but with a more carefully constructed
417+
hierarchy of categories.
418+
* Add prefixes to any commits that don't have them (they will be marked as
419+
"uncategorized" by git-cliff), and feel free to change any of the existing
420+
prefixes that you think are wrong or could be improved for clarity.
421+
* Rearrange the git-cliff output into the hierarchy of our preferred major
422+
release notes organization. Within each section and subsection, group
423+
similar changes together. The chronological order of the commits isn't as
424+
important as clearly explaining what changed over the course of the year.
425+
* The git-cliff output is a good starting point for populating the notes with
426+
every PR, plus automatically adding a reference and link to the PR and the
427+
name of the author of the patch.
428+
* Look with a skeptical eye at the one-line bullet points from git-cliff (i.e,
429+
from the first line of each PR's commit message). Often, they are too terse
430+
or tend to [bury the lede](https://www.dictionary.com/e/slang/bury-the-lede/).
431+
Expand into as much explanation is necessary for users who need to know
432+
about the change or feature to know whether it is relevant and have some
433+
idea what to do or that they should look at the relevant PRs for more
434+
detail.
435+
436+
Here is an example of well-constructed annual major release notes:
437+
https://github.com/AcademySoftwareFoundation/OpenImageIO/releases/tag/v2.5.4.0

docs/dev/Changes-skeleton-major.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Release 3.0 (Fall 2024) -- compared to 2.5
2+
-------------------------------------------------
3+
4+
### New minimum dependencies and compatibility changes:
5+
* *Blah*: Raise minimum to 1.2...
6+
7+
### ⛰️ Major new features and public API changes:
8+
* *New feature*: item
9+
* *New image file format support:*
10+
- Format1 explanation
11+
- Format2 explanation
12+
* *oiiotool*:
13+
- item
14+
* *ImageBuf/ImageBufAlgo*:
15+
- item
16+
* *Other categories or subsystems as needed*:
17+
18+
### 🚀 Performance improvements:
19+
- *subsystem*: item
20+
21+
### 🐛 Fixes and feature enhancements:
22+
* *subsystem*: item
23+
* *oiiotool*: item
24+
* *ImageBuf/ImageBufAlgo*:
25+
- item
26+
* *ImageCache/TextureSystem*:
27+
- item
28+
* *format*:
29+
- item
30+
31+
### 🔧 Internals and developer goodies
32+
- *int*: item
33+
- *header.h*: developer item
34+
35+
### 🏗 Build/test/CI and platform ports:
36+
* CMake build system and scripts:
37+
- item
38+
* Testing and Continuous integration (CI) systems:
39+
- *test*: item
40+
- *ci*: item
41+
* Platform support:
42+
- *win*: item
43+
44+
### 📚 Notable documentation changes:
45+
- *docs*: item
46+
47+
### 🏢 Project Administration
48+
- *admin*: item

docs/dev/Changes-skeleton-patch.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Release 1.2.3.4 (Month DD, YYYY) -- compared to 1.2.3.3
2+
-------------------------------------------------------
3+
- *category*: Description [#1234](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1234) (by someuser)
4+

0 commit comments

Comments
 (0)