ci(release): gate release-pr to the main ref (RIG-3813) - #1263
Open
rigel-mintaka wants to merge 1 commit into
Open
rigel-mintaka wants to merge 1 commit into
rigel-mintaka wants to merge 1 commit into
Conversation
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
Compass engineering docs preview: https://compass-native-rig-3813-rele.compass-eng-docs.pages.dev Deployed from |
`release.yml` accepts `workflow_dispatch` from any ref, but `release-pr` was the one sensitive job in the file with no `if:` guard. It holds `contents: write` + `pull-requests: write`, mints the release-please App token, and is the sole `vX.Y.Z` tag minter. release-please also defaults its `target-branch` to the repository default branch, so the dispatched ref did not scope what the job acted on: a dispatch from a feature branch would cut a real release from `main`. Gate it the way `publish-image`, `release-assets`, `release-image` and `publish-runner-image` already are, and pin `target-branch: main` explicitly so the release branch is stated rather than inferred. Every job in the file now carries an explicit guard. This also makes the dispatch-only `agent-image-arm64-spike` job safe to run from a non-main ref, which it was not before: the two jobs share the workflow, so any dispatch previously started `release-pr` alongside the spike. Scope: this governs future dispatches. Re-running a historical run replays that run's own workflow definition, so the guard cannot retroactively cover a pre-existing run. Co-authored-by: Matt Wilkinson <matt@rigel.build>
rigel-mintaka
force-pushed
the
compass-native/rig-3813-release-pr-ref-guard
branch
from
September 17, 2026 02:27
8271144 to
9918238
Compare
rigel-mintaka
added this pull request to stack #1272
September 17, 2026 02:32
rigel-mintaka
marked this pull request as ready for review
September 17, 2026 02:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes RIG-3813.
release.ymlacceptsworkflow_dispatchfrom any ref, andrelease-prwas the one sensitive jobin the file with no
if:guard. It holdscontents: write+pull-requests: write, mints theinstallation-scoped release-please App token, and is the sole
vX.Y.Ztag minter. Becauserelease-please defaults
target-branchto the repository default branch, the dispatched ref did notscope what the job acted on: a dispatch from a feature branch would cut a real release from
main.What changed
Two lines of real change in
.github/workflows/release.yml:release-prgetsif: github.ref == 'refs/heads/main', the same guardpublish-image,release-assets-macos,release-assets,release-imageandpublish-runner-imagealreadycarry.
target-branch: mainrather than relying on the action'sdefault-branch default, so the release branch is stated rather than inferred.
Why it matters now
The same workflow holds
agent-image-arm64-spike, which isif: github.event_name == 'workflow_dispatch'by design. Becauserelease-prwas ungated, any dispatch of this workflowstarted
release-pralongside the spike, which is what made that spike job unsafe to dispatch froma feature branch. With this guard, a non-main dispatch runs the spike and skips
release-pr.Verification
if:enumerated by parsing job line boundaries: all seven jobs now carry a guard, andrelease-pr's new one appears exactly once, inside its own block.target-branchconfirmed to be a real input of the action at its pinned SHA(
5c625bfb5d1ff62eadeeb3772007f7f66fdcf071), by decoding that ref'saction.yml.actionlintfrom the dev shell: 6 findings (3 shellcheck, 3 syntax-check), message sets identicalbetween base
mainand this tree after stripping line and column. The syntax-check findings arethe unknown
queue: maxconcurrency key at threeconcurrencyblocks and pre-date this change.Zero new findings.
pushtomainpath, which is the only path that previously reachedthis job legitimately.
Open Questions
None load-bearing. One judgment call recorded for the reviewer, stated precisely:
target-branch: mainis not what closes the dispatch hazard. The ref guard does, and with the guard present nonon-main ref reaches this job at all, so the pin contributes nothing to that attack path.
It is kept because it closes a different, real hazard. Without it, release-please reads the
repository's mutable
default_branchover the API on every run, so a branch rename silentlyrepoints the release lane. It also fixes the standing Release PR's head branch name, which
release-please derives as
release-please--branches--<target-branch>:mainis the value thatpreserves the identity of the existing Release PR, so any other pin would orphan it and open a
second one.