Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/api-version-guard.yml
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]
Comment thread
duncdrum marked this conversation as resolved.

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"
2 changes: 1 addition & 1 deletion modules/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openapi": "3.0.3",
"info": {
"title": "eXist-db Platform API",
"version": "0.9.0-SNAPSHOT",
"version": "0.9.0",
"description": "Unified REST API for eXist-db: query execution, language services, database management, user management, package management, search, and cross-app linking.",
"license": {
"name": "LGPL-2.1",
Expand Down