Skip to content

ci: refuse to publish commits that are not on the release branch - #28

Merged
Cafe137 merged 4 commits into
mainfrom
ci/release-commit-guard
Nov 17, 2026
Merged

Cafe137 merged 4 commits into
mainfrom
ci/release-commit-guard

Conversation

@darkobas2

Copy link
Copy Markdown
Contributor

Adds a first step to the publish workflow that checks, via the compare API, that the commit being released is already on main. A release or tag pointing at a commit that never landed there now fails before checkout, build or publish, even if the deployment is approved.

Non-tag runs are unaffected: the step only runs for release events
or tag refs.

darkobas2 and others added 3 commits November 10, 2026 00:38
Add a first step to the publish job that uses the compare API to
check that the commit being released is already contained in
`main`. A release or tag pointing at a commit that never
landed there now fails before anything is checked out, built or
published, regardless of environment approval.
Move the check out of the publishing job(s) into a verify job they need. A bad commit
is now rejected before the environment approval is requested and before
any job receives publishing secrets or tokens, and verify only gets
contents: read.
@Cafe137
Cafe137 deployed to gemini-review November 17, 2026 09:49 — with GitHub Actions Active
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Gemini review: pass

Reviewed fc54f4767210, 1 file(s).

This PR adds a verification job to the npm publish workflow to ensure that commits triggered by releases or tags are ancestors of the main branch before proceeding to the publish job. No malicious patterns or critical security issues were found, though the conditional check skips verification for non-tag/non-release triggers.

  • low .github/workflows/publishnpmjs.yml:20: The verification step only runs when github.eventname is release or github.ref starts with refs/tags/. If this workflow can be triggered via workflowdispatch or another event on a non-main branch, the step is skipped, the verify job succeeds, and the publish job can still run for a commit not on main.

Automated check. High/critical findings block merging; a human approval is still required. False positive? Ask devops to bypass.

@Cafe137
Cafe137 deployed to gemini-review November 17, 2026 10:07 — with GitHub Actions Active
@Cafe137
Cafe137 merged commit 4b515ed into main Nov 17, 2026
4 checks passed
@darkobas2
darkobas2 deleted the ci/release-commit-guard branch November 17, 2026 10:18

This branch was successfully deployed

1 active deployment
gemini-review — fc54f476 Deployed Nov 17, 2026 by Cafe137 via gemini-review #5
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.

2 participants