Repository navigation
ci: hold the release while the merge queue has entries, and cancel replaced queue runs - #563
Merged
Merged
Conversation
Each release commit moves main under the merge queue, and GitHub builds every queued pull request again on top of it, a full CI run per entry: on 2026-11-04, 6.29.13 and 6.29.14 each sent the waiting pull requests back to the start. A push run now releases only once the queue for main is empty, so the last pull request to leave it releases every commit since the last tag as one version. A new queue job asks GitHub's GraphQL API for the entries' count with a token that can only read, and no secret or environment; the release job, its hardening unchanged, needs it. A query that fails fails the run instead of releasing or holding back in silence. A run by hand still releases main's tip whatever the queue holds, which is also how commits are released when the last entry fails or leaves the queue. Refs: #560
CI's concurrency group was keyed on the ref, and the merge queue builds each entry again on a new ref, gh-readonly-queue/main/pr-<N>-<base>, whenever main moves under it or an entry ahead leaves. So a rebuild canceled nothing: run 41787567397 (pr-556-231080f24c) went on for 9 more minutes after its rebuild, with most of its jobs not yet started, taking runners from the pull requests waiting for one. A merge_group run's group is now keyed on its merge commit's message, "Merge pull request #<N> from ...", which every build of one entry keeps (pr-556-231080f2, pr-556-ef7875bf and pr-556-44cddef0 had the same) and no other entry has. Queue runs already cancel in progress; pull request and main runs keep the groups they had. Closes: #560
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 and why
Runs that start together share 20 runners, and in a busy merge queue many runs are ones nobody needs. Each release commit moves
mainunder the queue, and GitHub builds every queued pull request again on top of it. On 2026-11-04, 6.29.13 and 6.29.14 each sent the waiting pull requests back to the start. Each run that was replaced also kept going: CI's concurrency group was keyed on the ref, and every build of a queue entry gets a ref of its own. Run 41787567397 (pr-556-231080f24c) went on for 9 minutes after its rebuild, with most of its jobs not yet started. This branch does what #560 proposes, in two commits.queuejob inrelease.ymlasks GitHub's GraphQL API how many entries the merge queue formainholds. It runs with a token that can only read, and with no secret, environment or checkout. Thereleasejob needs it, and a push run releases only when the count is 0. Once the last pull request leaves the queue, its push run releases every commit since the last tag as one version. A query that fails fails the run, instead of releasing or holding back without a word. A run by hand (workflow_dispatch) still releasesmain's tip whatever the queue holds. That is also how commits are released when the last entry fails or leaves the queue. Thereleasejob's environment, key and permissions are unchanged, andscripts/releaseWorkflow.test.tsholds thatqueuestays without secrets.merge_grouprun's concurrency group is now keyed on its merge commit's message (Merge pull request #<N> from …). Every build of one entry keeps that message, and no other entry has it:pr-556-231080f2,pr-556-ef7875bfandpr-556-44cddef0all had the same one. Queue runs already cancel in progress. Pull request andmainruns keep the groups they had, the release commit's own group included.To watch on GitHub after merging. These can't be tested outside GitHub:
contents: read. If its first run fails with "Resource not accessible by integration", it needspull-requests: readtoo.Closes: #560