Skip to content

Commit 8eb8376

Browse files
localai-botmudler
andauthored
fix(ci): dedup the three workflows that stack runs on every PR push (#11058)
build-test.yaml, yaml-check.yml and secscan.yaml had no concurrency block at all, so every push to a PR stacked another full batch instead of superseding the previous one. build-test carries a macos-latest job, the scarcest runner class we use, and secscan fires on every push to every branch because its `push:` trigger is unfiltered. build-test and yaml-check use the same group idiom as lint.yml and the other eleven workflows that already have one: key on the PR number so pushes to a PR share a group, and cancel only on pull_request. On a master push the key falls back to github.sha and cancel-in-progress is false, so master runs never cancel each other -- that is deliberate, since backend.yml builds only the backends a given commit touched and superseding would drop those builds. secscan needs a different key: it has no pull_request trigger, so the shared idiom would fall back to the unique-per-commit sha and dedup nothing. It groups on github.ref instead, and excludes master from cancellation for the same per-commit reason. Cancelling a superseded feature-branch scan is safe because the only output is a SARIF upload and code scanning keeps the latest result per ref. No behaviour change on master for any of the three. Assisted-by: Claude:claude-opus-4-8 [Claude Code] Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
1 parent 16033d5 commit 8eb8376

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

.github/workflows/build-test.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ on:
66
- master
77
pull_request:
88

9+
# Supersede an in-flight run when a PR gets a new push. Keyed on the PR number
10+
# so every push to the same PR shares a group; on a master push the key falls
11+
# back to github.sha (unique per commit) and cancel-in-progress is false, so
12+
# master runs never cancel each other -- each commit is built on its own.
13+
concurrency:
14+
group: ci-build-test-${{ github.event.pull_request.number || github.sha }}-${{ github.repository }}
15+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
16+
917
jobs:
1018
build-test:
1119
runs-on: ubuntu-latest

.github/workflows/secscan.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ on:
77
schedule:
88
- cron: '0 0 * * 0'
99

10+
# `push:` is deliberately unfiltered, so this fires on every push to every
11+
# branch and there is no pull_request event to key on -- the usual
12+
# `github.event.pull_request.number || github.sha` idiom used elsewhere would
13+
# key on the unique-per-commit sha and dedup nothing. Group on the ref instead
14+
# so successive pushes to the same feature branch supersede one another.
15+
#
16+
# Cancelling is safe here: the only output is a SARIF upload, and code scanning
17+
# tracks the latest result per ref, so a superseded scan has nothing to lose.
18+
# master is excluded anyway -- every commit on master gets its own scan.
19+
concurrency:
20+
group: ci-secscan-${{ github.ref }}-${{ github.repository }}
21+
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
22+
1023
jobs:
1124
tests:
1225
runs-on: ubuntu-latest

.github/workflows/yaml-check.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: 'Yamllint GitHub Actions'
22
on:
33
- pull_request
4+
5+
concurrency:
6+
group: ci-yamllint-${{ github.event.pull_request.number || github.sha }}-${{ github.repository }}
7+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
8+
49
jobs:
510
yamllint:
611
name: 'Yamllint'

0 commit comments

Comments
 (0)