Skip to content

🔒 security(ci): require release tags to be merged into main - #234

Merged
SamErde merged 1 commit into
mainfrom
samerde-guard-release-tag-ancestry
Sep 15, 2026
Merged

SamErde merged 1 commit into
mainfrom
samerde-guard-release-tag-ancestry

Conversation

@SamErde

@SamErde SamErde commented Sep 15, 2026

Copy link
Copy Markdown
Owner

Problem

The release workflow triggers purely on a v*.*.* tag push, with no check that the tagged commit was ever merged into main via a completed pull request. A tag pushed directly on a feature branch can trigger a full release and PowerShell Gallery publish while the corresponding PR is still open.

This happened with v2.2.0 / #233: the tag was pushed to the feature branch and the release/publish completed successfully before the PR was reviewed or merged.

Fix

Add a 🔒 Verify Tag Is on Main step immediately after checkout that fails the job if the tagged commit is not an ancestor of origin/main:

if ! git merge-base --is-ancestor "$GITHUB_SHA" origin/main; then
  echo "::error::Tag $GITHUB_REF_NAME points to commit $GITHUB_SHA, which is not an ancestor of origin/main. Merge the corresponding pull request into main before tagging a release."
  exit 1
fi
  • actions/checkout now uses fetch-depth: 0 so the full history (including main) is available for the ancestry check.
  • The workflow's header comment is updated to document the new requirement.

Effect

  • A release/publish can now only happen for a tag that is already reachable from main — i.e., after the corresponding PR has merged.
  • No change to the tag-push trigger itself, changelog extraction, build, or publish steps otherwise.
  • workflow_dispatch manual runs still work the same way and are also subject to this check if run against a refs/tags/* ref.

Testing

  • Validated workflow YAML parses correctly.
  • No functional changes to build/test/archive/publish steps.

Add a Verify Tag Is on Main step that checks the tagged commit is an

ancestor of origin/main before building/publishing, so a release can

only happen after the corresponding PR has merged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 43 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 3a867041-715d-4e3c-b8c6-55a164a94aa9

📥 Commits

Reviewing files that changed from the base of the PR and between 05ba41d and c2003ba.

📒 Files selected for processing (1)
  • .github/workflows/Publish Release.yml

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c2003ba481

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/Publish Release.yml Resolved
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-15T03:05:06.419760Z c2003ba PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@SamErde
SamErde merged commit f9d6a34 into main Sep 15, 2026
12 checks passed
@SamErde
SamErde deleted the samerde-guard-release-tag-ancestry branch September 15, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant