Skip to content

Commit 1cb4f8f

Browse files
authored
chore: add check for version_next markers (bazel-contrib#2542)
In a couple recent PRs, I put "VERSION_NEXT_{feature,patch}" as place holders since I wasn't sure what the next appropriate version would be for unreleased code. e.g. specifying `1.0.1` becomes invalid if a subsequent PR would make it `1.1.0`. To help remind us to populate these values before a release, have the release workflow check for the marker strings.
1 parent fbf8bc1 commit 1cb4f8f

File tree

2 files changed

+50
-3
lines changed

2 files changed

+50
-3
lines changed

.github/workflows/create_archive_and_notes.sh

+8
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515

1616
set -o errexit -o nounset -o pipefail
1717

18+
# Exclude dot directories, specifically, this file so that we don't
19+
# find the substring we're looking for in our own file.
20+
if grep --exclude-dir=.* VERSION_NEXT_ -r; then
21+
echo
22+
echo "Found VERSION_NEXT markers indicating version needs to be specified"
23+
exit 1
24+
fi
25+
1826
# Set by GH actions, see
1927
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
2028
TAG=${GITHUB_REF_NAME}

CONTRIBUTING.md

+42-3
Original file line numberDiff line numberDiff line change
@@ -137,19 +137,58 @@ If a breaking change is introduced, then `BREAKING CHANGE:` is required; see
137137
the [Breaking Changes](#breaking-changes) section for how to introduce breaking
138138
changes.
139139

140+
User visible changes, such as features, fixes, or notable refactors, should
141+
be documneted in CHANGELOG.md and their respective API doc. See [Documenting
142+
changes] for how to do so.
143+
140144
Common `type`s:
141145

142146
* `build:` means it affects the building or development workflow.
143147
* `docs:` means only documentation is being added, updated, or fixed.
144-
* `feat:` means a user-visible feature is being added.
145-
* `fix:` means a user-visible behavior is being fixed.
146-
* `refactor:` means some sort of code cleanup that doesn't change user-visible behavior.
148+
* `feat:` means a user-visible feature is being added. See [Documenting version
149+
changes] for how to documenAdd `{versionadded}`
150+
to appropriate docs.
151+
* `fix:` means a user-visible behavior is being fixed. If the fix is changing
152+
behavior of a function, add `{versionchanged}` to appropriate docs, as necessary.
153+
* `refactor:` means some sort of code cleanup that doesn't change user-visible
154+
behavior. Add `{versionchanged}` to appropriate docs, as necessary.
147155
* `revert:` means a prior change is being reverted in some way.
148156
* `test:` means only tests are being added.
149157

150158
For the full details of types, see
151159
[Conventional Commits](https://www.conventionalcommits.org/).
152160

161+
### Documenting changes
162+
163+
Changes are documented in two places: CHANGELOG.md and API docs.
164+
165+
CHANGELOG.md contains a brief, human friendly, description. This text is
166+
intended for easy skimming so that, when people upgrade, they can quickly get a
167+
sense of what's relevant to them.
168+
169+
API documentation are the doc strings for functions, fields, attributes, etc.
170+
When user-visible or notable behavior is added, changed, or removed, the
171+
`{versionadded}`, `{versionchanged}` or `{versionremoved}` directives should be
172+
used to note the change. When specifying the version, use the values
173+
`VERSION_NEXT_FEATURE` or `VERSION_NEXT_PATCH` to indicate what sort of
174+
version increase the change requires.
175+
176+
These directives use Sphinx MyST syntax, e.g.
177+
178+
```
179+
:::{versionadded} VERSION_NEXT_FEATURE
180+
The `allow_new_thing` arg was added.
181+
:::
182+
183+
:::{versionchanged} VERSION_NEXT_PATCH
184+
Large numbers no longer consume exponential memory.
185+
:::
186+
187+
:::{versionremoved} VERSION_NEXT_FEATURE
188+
The `legacy_foo` arg was removed
189+
:::
190+
```
191+
153192
## Generated files
154193

155194
Some checked-in files are generated and need to be updated when a new PR is

0 commit comments

Comments
 (0)