Repository navigation
fix(release): a release merged in one push with other PRs publishes at its own commit - #8077
Merged
Merged
Conversation
…nd published at its own commit
jrusso1020
approved these changes
Nov 17, 2026
jrusso1020
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed at ecbeec2. No blockers.
Correctness
release-sourcenow reads every commit incompare/<before>...<after>and outputs the release PR's own merge commit assha.- Every later job uses that sha, not
github.sha. All four checkouts useref: ${{ env.EXPECTED_RELEASE_SHA }}, three re-check it withgit rev-parse HEAD, and the tag, GitHub Release and receipt all use the same commit. The only remaininggithub.shareads are the tag-path check and the step's ownSHA. - The queue squashes (
merge_method: SQUASH), so main is linear and the compare list is complete and oldest-first.
Checked against the GitHub API:
- There is no publish run for
fbcdf4ca; run 44104887657 for72925380covered both commits. - A 300-commit compare lists 250 commits with
total_commits: 300, and the guard catches that. - A backward range returns
behindwith 0 commits, which reads as nothing to publish. - An unknown
beforefails closed underbash -e. - An all-zeros
beforefalls back to the tip, as before.
Security
- The PR filters are unchanged, just applied per commit:
merged_at, basemain,merge_commit_sha == commit, head repo equal to this repo (so a fork'srelease/v…branch is excluded), and the ref regex. - The approval gate applies to whichever PR is selected.
- There's no injection path. Subjects pass through jq
@tsv+readand are only used in[[ =~ ]], andBEFORE/HEAD_MESSAGEcome in through env.
Verified
node --test scripts/publish-workflow.test.mjspasses 26/26.- Mutation: outputting the tip
shafails the release-below-the-tip test. - Both commits are signed. CI: 0 failed.
Recovery: this PR can't publish fbcdf4ca itself. Later runs only read their own push range, and there is no dispatch trigger. Re-cutting 0.9.62 also won't work, because release-only-diff --verify requires a version change. So the path is a normal release/v0.9.63 after this lands, and its notes should say 0.9.62 was never published. npm latest will go from 0.9.61 to 0.9.63, and releases/v0.9.62.md describes a version that doesn't exist on npm.
Nits (non-blocking)
- Nothing tests release commits in two different commits of one push. Keeping only the last release found passes all 26 tests. The code handles that case, and a temporary test I wrote catches the mutation.
:112says "$SHAis the merge of more than one release PR". It should be "the push to$SHA…".- The body says "A rerun recovers either case", but a rerun can't recover the more-than-250-commits case, because it sees the same push.
Need from author: nothing.
— Rames
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.
What
A stable release that the merge queue lands in one push together with other PRs now publishes. It publishes at its own merge commit, not at the push's last commit.
Why
The merge queue can merge several queued PRs in one push to
main. GitHub runspublish.ymlonce for that push, withgithub.shaset to the push's last commit. The release check looked only at that commit's PR. When the release PR's commit was not last, the run found no release PR, printed "merges no release PR; nothing to publish", and skipped every job after it. v0.9.62 (#8075) merged that way, in one push with #8073, so it never reached npm. Rerunning that run can't help: it has the same last commit and the old workflow file.How
In
.github/workflows/publish.yml, "Find the release this push publishes" now:compare/<before>...<after>). A push that created the branch (beforeall zeros) reads only its last commit, as before.release/vX.Y.ZPR from this repo whose merge commit is that commit. Exactly one is still required.sha. Every later job already checks out, verifies, tags and publishesEXPECTED_RELEASE_SHA(needs.release-source.outputs.sha), so the release ships exactly the reviewed release commit, without the PRs merged after it in the same push.chore: release v…) but GitHub hasn't linked it to its PR yet, where it used to check only the last commit's subject. It also fails if the push has more commits than the compare API lists. A rerun recovers either case.The tag path is unchanged.
Test plan
fails without the fix: "a push to main publishes only the merge of exactly one approved release PR from this repo" in
scripts/publish-workflow.test.mjsfails with main'spublish.yml(test-only commitfd84cab4) in 3 of 3 runs. Its new case is a push of a release commit followed by another PR's commit.ecbeec23),node --test scripts/publish-workflow.test.mjspasses 26 of 26 tests, 3 runs in a row (Node 24, Linux).main.