Skip to content

Verify tag commit is reachable from master before release #292

@nanotaboada

Description

@nanotaboada

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 for origin/master in 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    containersPull requests that update containers codeenhancementNew feature or requestgithub_actionsPull requests that update GitHub Actions codepriority lowNice-to-have improvement. Can be deferred without blocking other work.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions