From 644636c2fb49bb7b6050d6ddd953d52e10e82258 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 18 Sep 2026 16:40:17 +0000 Subject: [PATCH] ci: cancel superseded pull request runs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The per-job concurrency groups already cancelled a superseded job when its replacement was queued, but they cancelled pushes to the release branches the same way. Those runs publish coverage, and cancelling one also hides a breakage that is already on the branch. Replace them with a single 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. Besides fixing that, one workflow-level group cancels the whole superseded run at once rather than job by job as each replacement is queued, it covers jobs that have no group of their own, and a matrix dimension added later cannot be forgotten in a group key. `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/nodejs.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 5fc2ff0d02f..f270d80dfe1 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -10,6 +10,18 @@ on: - main - next +# A new commit supersedes the previous one's jobs, so stop paying for them +# across the whole matrix below. 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. +# Runs for the branches this also builds on push publish the coverage later +# comparisons are measured against, and losing one would also hide a breakage +# that is already on the 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 @@ -19,10 +31,6 @@ jobs: runs-on: ${{ matrix.os }} - concurrency: - group: lint-${{ github.ref }} - cancel-in-progress: true - strategy: matrix: os: [ubuntu-latest] @@ -53,10 +61,6 @@ jobs: runs-on: ${{ matrix.os }} - concurrency: - group: test-${{ matrix.os }}-v${{ matrix.node-version }}-${{ matrix.webpack-version }}-${{ matrix.dev-server-version }}-${{ github.ref }} - cancel-in-progress: true - strategy: fail-fast: true matrix: @@ -109,10 +113,6 @@ jobs: runs-on: ${{ matrix.os }} - concurrency: - group: smoketests-${{ github.ref }} - cancel-in-progress: true - strategy: matrix: os: [ubuntu-latest]