Repository navigation
ci: cancel superseded PR runs - #852
niteshb3495 wants to merge 2 commits into
Conversation
Add a concurrency group that cancels an older in-progress run for the same PR (master pushes are not cancelled), set contents: read on the test job, and add a 15 minute timeout to it.
|
Could you give non-PR events a unique concurrency group (for example one keyed by |
Key the concurrency group by github.run_id for non-pull_request events so pushes never replace a pending push on the same ref. Only pull_request runs cancel in progress. Drop the 15-minute test job timeout, per review.
|
Thanks for the review, @rs! Good catch on the pending-push case. I've updated the PR: non-PR events now get a unique concurrency group keyed by |
A small change to
.github/workflows/test.yml:Cancel superseded PR runs. Adds a
concurrencygroup keyed on the PR number, so pushing a new commit to a pull request cancels that PR's older in-progress Test run.cancel-in-progressis only true forpull_requestevents. Non-PR events get a unique concurrency group keyed bygithub.run_id, so pushes never replace pending pushes, and push, tag, schedule and manual runs are never cancelled (this includes pushes tomaster).Why: from the public Actions data for the 100 most recent runs (8 Sep - 3 Dec 2026), 5 of 12 consecutive same-branch pairs of Test runs overlapped, i.e. the newer run started before the older one had finished. One commit also ran Test for both
pushandpull_request. I'm not quoting a time saving: many of those runs waited for approval, so their wall times aren't reliable. The runners are free on a public repo, so the gain is mostly faster feedback and less queueing.One small extra on the
testjob (thecoveragejob is untouched, since the coverage action may need to write):permissions: contents: read, since the job only checks out and runsgo test.Checked:
actionlintreports nothing on the file. The change merges cleanly with #793 and #775, which touch different lines of the same file.