From e0a7b6652aceee904e33841ba11157a20be8e99a Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 18 Sep 2026 16:38:27 +0000 Subject: [PATCH] ci: cancel superseded pull request runs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `test.yml` has no concurrency control, so pushing a new commit to a pull request leaves the previous commit's jobs running to completion even though nobody will read their results. Add a workflow-level group. Only pull request runs share it; every other run gets `github.run_id`, a group of one, because a group holds at most one pending run and GitHub evicts that pending run whenever a newer one enters the group — `cancel-in-progress` protects the running run, not the queued one. Pushes to `main` therefore always complete: they publish the coverage later comparisons are measured against, and losing one would also hide a breakage already on the default branch. `benchmarks.yml` already had a group, but with an unconditional `cancel-in-progress: true`, so a push to `main` cancelled the in-flight benchmark run for the previous `main` commit. CodSpeed compares a pull request against the benchmark result of its base commit, so that leaves later comparisons without a baseline. It now uses the same expression. `release.yml` is untouched: its string-form group leaves `cancel-in-progress` false, so releases queue rather than cancel. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_016aGHrb1YaEvaGwNELGEHjF --- .github/workflows/benchmarks.yml | 9 +++++++-- .github/workflows/test.yml | 11 +++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index cec1ccc..2fa357e 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -7,9 +7,14 @@ on: branches: [main] workflow_dispatch: +# Only pull request runs share a group; every other run gets a group of its own +# (`github.run_id`), because a group holds at most one pending run and a later +# push would otherwise evict the one waiting. CodSpeed compares a pull request +# against the benchmark result of its base commit, so a `main` commit that never +# gets measured leaves later comparisons without a baseline. concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} permissions: contents: read diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 10024e0..e3d8606 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,6 +6,17 @@ on: pull_request: branches: [main] +# A new commit supersedes the previous one's jobs, so stop paying for them. +# Only pull request runs share a group; every other run gets a group of its own +# (`github.run_id`), because a group holds at most one pending run and a later +# push would otherwise evict the one waiting — `cancel-in-progress` protects the +# running run, not the queued one. `main` runs publish the coverage later +# comparisons are measured against, and losing one would also hide a breakage +# that is already on the default branch. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + permissions: contents: read # to fetch code (actions/checkout)