Repository navigation
ci: cancel a pull request's checks when it merges or closes - #453
Merged
Merged
Conversation
A PR merged while its checks were still queued kept those runs, and they ran in full after the merge: about 300 to 400 job-minutes each for #430, #435, #436 and #437, while the merge's own run on main tested the same change again. Every check workflow that runs on pull requests now also starts on the PR's `closed` event. That run joins the PR's concurrency group, whose cancel-in-progress cancels the PR's queued and running checks, and every job skips on that event, so the cancelling run itself needs no runner. The notification and relock workflows are left out because they run no checks. A test checks each check workflow's trigger types and that every job that can start a run skips on `closed`. This is step 1 of the #405 proposal. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The DOM member table workflow landed after the first commit and also runs checks on pull requests. The workflow test now finds every pull-request workflow except the two that run no checks, so a new one is covered without a list edit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
JuroOravec
force-pushed
the
ci/cancel-runs-of-closed-prs
branch
from
October 28, 2026 09:54
4c51e3c to
7dc7fe4
Compare
JuroOravec
marked this pull request as ready for review
October 28, 2026 09:54
Member
Author
|
The failing |
This was referenced Oct 28, 2026
This was referenced Oct 28, 2026
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.
Part of #405, step 1, which Juro approved.
Problem
A PR merged while its checks were still queued kept those runs, and they ran in full after the merge. The jobs that started after the merge used about 375 job-minutes for #436, 381 for #435, 355 for #430 and more than 295 for #437. #437's Python tests run was still queued more than two hours after the merge. Meanwhile the merge's own run on
maintested the same change again. The existing concurrency groups cancel only a run that a newer push replaces; nothing cancels on close or merge.Change
Ten check workflows now also start on the PR's
closedevent: py--examples--tests, py--tests, repo--check, repo--codeql, repo--docs-check, repo--docs-lighthouse, repo--dom-members, repo--generated, repo--security and rust--tests.closedrun joins the PR's existing concurrency group (${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}). The group'scancel-in-progress, which is true forpull_requestevents, cancels the PR's queued and running checks.needshasif: github.event.action != 'closed', and jobs withneedsskip with the jobs they need. So the cancelling run takes no runner, which matters because the runners are what is saturated.github.event.actionis empty there, so those jobs run as before.test_ci_workflows.pygainstest_check_workflows_cancel_a_pull_requests_runs_when_it_closes. It finds every workflow with apull_requesttrigger, except repo--discord-pr and repo--dependabot-relock, which run no checks. For each, it checks the trigger types and that every job that can start a run skips onclosed, so a new check workflow is covered without a list edit. The existing concurrency-block test is unchanged and still passes.What to watch after merging
checkstatus: a closed PR's head commit gets a skippedcheckstatus from the cancelling run. Branch protection only reads open PRs, and reopening a PR starts a full run (reopened).closedthe same way as to the original run, so a workflow that did not run for the PR does not start a cancelling run either.Evidence
scripts/validate.pypasses.🤖 Generated with Claude Code