-
Notifications
You must be signed in to change notification settings - Fork 7
Verify tag commit is reachable from master before release #292
Description
Summary
Add a runtime verification step to the CD workflow (.github/workflows/maven-cd.yml) that checks whether the tag's commit is reachable from master before proceeding with build and publish steps. This ensures the CD pipeline does not trigger on an unmerged commit if a tag is accidentally pushed from a release branch before the PR is merged.
Motivation
The CD workflow currently triggers on any tag matching v*.*.*-* with no safeguard that the tag points to a commit contained in master. The Pre-Release Checklist enforces process discipline (merge before tagging), but a runtime guard in the workflow would provide an additional safety net.
Proposed Approach
Add a step named "Verify tag commit is reachable from master" to the existing release job, placed immediately after Checkout repository. A separate job is not warranted here — the checkout already uses fetch-depth: 0 so full git history is available, and the check is lightweight enough that spinning up a second runner would be unnecessary overhead.
The step should verify that ${{ github.sha }} is reachable from refs/heads/master using either:
git branch -r --contains ${{ github.sha }}and checking fororigin/masterin the output, or- The GitHub API to confirm the commit is an ancestor of
refs/heads/master
The job should fail with a clear error message if the check does not pass.
Acceptance Criteria
- Workflow fails early with a descriptive error if the tag commit is not reachable from
master - No regressions on valid release tags pushed from a merged commit
- Step is placed before any build, test, or publish steps