Skip to content

Commit 42b498f

Browse files
abnobdossAbanoub Doss
andauthored
ci: cancel superseded runs in remaining workflows (#767)
## What Add a concurrency block to the five workflows that don't have one — `cpp-linter`, `pre-commit`, `license_check`, `zizmor`, and `codeql`: ```yaml concurrency: group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} cancel-in-progress: true ``` ## Why The heavier workflows already cancel outdated runs, but these five don't - so pushing again to a PR leaves the old runs going and tying up runners. Grouping on `head_ref || sha` cancels superseded PR runs while leaving `main` and scheduled runs untouched. Co-authored-by: Abanoub Doss <abanoub.doss@gmail.com>
1 parent 0aff5e9 commit 42b498f

5 files changed

Lines changed: 20 additions & 0 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ on:
2828
schedule:
2929
- cron: '16 4 * * 1'
3030

31+
concurrency:
32+
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
33+
cancel-in-progress: true
34+
3135
permissions:
3236
contents: read
3337

.github/workflows/cpp-linter.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ on:
2727
branches:
2828
- main
2929

30+
concurrency:
31+
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
32+
cancel-in-progress: true
33+
3034
jobs:
3135
cpp-linter:
3236
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}

.github/workflows/license_check.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ on:
2121
pull_request:
2222
types: [opened, synchronize, reopened, ready_for_review]
2323

24+
concurrency:
25+
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
26+
cancel-in-progress: true
27+
2428
permissions:
2529
contents: read
2630

.github/workflows/pre-commit.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ on:
2525
- '**'
2626
- '!dependabot/**'
2727

28+
concurrency:
29+
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
30+
cancel-in-progress: true
31+
2832
permissions:
2933
contents: write
3034

.github/workflows/zizmor.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ on:
2626
types: [opened, synchronize, reopened, ready_for_review]
2727
branches: ["**"]
2828

29+
concurrency:
30+
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
31+
cancel-in-progress: true
32+
2933
permissions: {}
3034

3135
jobs:

0 commit comments

Comments
 (0)