From 5aff8f843ff872a79020cff4f62b2c77e46b90e8 Mon Sep 17 00:00:00 2001 From: William Smith Date: Tue, 17 Nov 2026 19:19:19 -0800 Subject: [PATCH] ci: cancel a pull request's superseded check runs A wave of pull requests and merges queued over a hundred runs that newer commits had already replaced, and every account shares one runner limit. CI, Security, Malware scan and Fuzz now share the standard concurrency block from repo-standards. A new push to a pull request cancels that pull request's older runs. A push to main waits for the run before it and never cancels one, and only the newest waiting run starts, so the tip of main is always checked. Scheduled, hand-started and Publish runs each get a group of their own. The gate still passes only when every job succeeded, so a cancelled run cannot satisfy the ruleset. --- .github/workflows/ci.yml | 6 ++++++ .github/workflows/malware-scan.yml | 6 ++++++ .github/workflows/security.yml | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75c8d97..96bcdda 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,12 @@ env: DOTNET_CLI_TELEMETRY_OPTOUT: "1" DOTNET_NOLOGO: "1" +# A new push to a pull request cancels its older runs. A push to main waits +# for the run before it, and only the newest waiting run starts. +concurrency: + group: ci-${{ github.workflow }}-${{ (github.event_name == 'pull_request' || github.event_name == 'push') && github.ref || github.run_id }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: build: name: Build and pack the NuGet package diff --git a/.github/workflows/malware-scan.yml b/.github/workflows/malware-scan.yml index 1ae675b..235706e 100644 --- a/.github/workflows/malware-scan.yml +++ b/.github/workflows/malware-scan.yml @@ -30,6 +30,12 @@ on: permissions: contents: read +# A new push to a pull request cancels its older runs. A push to main waits +# for the run before it, and only the newest waiting run starts. +concurrency: + group: malware-scan-${{ github.workflow }}-${{ (github.event_name == 'pull_request' || github.event_name == 'push') && github.ref || github.run_id }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: # The package both engines scan: the caller's when Publish passes one, # otherwise built here exactly as CI and Publish build it. diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index 05e4dd3..0179695 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -24,6 +24,12 @@ on: permissions: contents: read +# A new push to a pull request cancels its older runs. A push to main waits +# for the run before it, and only the newest waiting run starts. +concurrency: + group: security-${{ github.workflow }}-${{ (github.event_name == 'pull_request' || github.event_name == 'push') && github.ref || github.run_id }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: codeql: name: CodeQL (${{ matrix.language }})