Repository navigation
fix(promote-release): gate promote on release-PR mergeability - #1133
Merged
Merged
Conversation
validate verified the release PR was non-draft, approved, and CI-green but never checked mergeability. Since promote (undraft, irreversible) runs before merge, a BEHIND/BLOCKED/DIRTY PR passed validation, the Release was published, then merge failed — a half-promoted release. Fetch mergeable/mergeStateStatus in the validate PR check and fail fast unless mergeable, re-querying while GitHub reports UNKNOWN. Refs: #1132
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.
Summary
promote-release.yml'svalidatejob verified the release PR was non-draft,approved, and CI-green — but never checked whether it was actually mergeable.
Because the sequence is
validate → promote (undraft, irreversible under immutable releases) → merge, a PR that wasBEHINDmain(orBLOCKED/DIRTY) passedvalidation, the GitHub Release was published, and only then did the merge fail —
leaving a half-promoted release whose PR never reached
mainand which cannotbe re-run to recover.
Observed on vig-os/commit-action 0.3.0 promote (release branch 5 CI-only commits
behind
main;mainenforces "require branches up to date").Change
In
validate → Find and verify release PR, after the existing draft/approval/CIchecks, fetch
mergeable+mergeStateStatusviagh pr viewand fail fastunless the PR is mergeable:
CLEAN/HAS_HOOKS/UNSTABLE(CI already asserted green separately)BEHIND(with a "update the release branch" hint),BLOCKED,DIRTYUNKNOWN(GitHub computes mergeability async)This keeps the invariant: never start the irreversible publish unless the merge
can succeed. Scope is the downstream scaffold template
(
assets/workspace/.github/workflows/promote-release.yml); the primary fail-fastvalidategate the issue asked for.The secondary considerations in the issue (TOCTOU between
validateandmerge;gh pr merge --auto/ branch-update in themergestep) are intentionally leftout of this minimal fix.
Tests
tests/test_promote_mergeability.py(new) pins thatvalidate's PR checkqueries
mergeable/mergeStateStatus, rejectsBEHIND, and re-queriesUNKNOWN. Added RED-first, then implemented.actionlint(shellcheck on the embedded run script) and the full pre-commitsuite are green.
Closes #1132