-
Notifications
You must be signed in to change notification settings - Fork 2
build(api): guard that api.json changes require an info.version bump #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
duncdrum
merged 2 commits into
eXist-db:develop
from
joewiz:build/api-json-version-from-project-version
Jun 16, 2026
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| name: API version guard | ||
|
|
||
| # The OpenAPI contract version (modules/api.json -> info.version) is tracked | ||
| # independently of the package version (pom.xml): the contract changes far less | ||
| # often than the package. This guard enforces the one invariant that keeps the | ||
| # contract version honest — if api.json changes in a PR, info.version must change | ||
| # too. It does not police the size of the bump (patch/minor/major); that is left | ||
| # to the author's semver judgment (and to a future automation, see the follow-up). | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [develop] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| api-version-bump: | ||
| name: Require an info.version bump when api.json changes | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Check modules/api.json info.version | ||
| run: | | ||
| base='${{ github.event.pull_request.base.sha }}' | ||
| if git diff --quiet "$base" HEAD -- modules/api.json; then | ||
| echo "modules/api.json unchanged in this PR — no API version bump required." | ||
| exit 0 | ||
| fi | ||
| old=$(git show "$base:modules/api.json" | jq -r '.info.version') | ||
| new=$(jq -r '.info.version' modules/api.json) | ||
| echo "modules/api.json changed. info.version: '$old' -> '$new'" | ||
| if [ "$old" = "$new" ]; then | ||
| echo "::error file=modules/api.json::modules/api.json changed but info.version did not (still '$new'). The OpenAPI contract version is tracked independently of the package version — bump info.version whenever the API contract changes." | ||
| exit 1 | ||
| fi | ||
| echo "info.version was bumped — OK" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.