From 8eb83765963c96aa9c087aecaab354bd9df5e0db Mon Sep 17 00:00:00 2001 From: "mudler's LocalAI [bot]" <139863280+localai-bot@users.noreply.github.com> Date: Wed, 22 Jul 2026 22:51:11 +0200 Subject: [PATCH] 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 Co-authored-by: Ettore Di Giacinto --- .github/workflows/build-test.yaml | 8 ++++++++ .github/workflows/secscan.yaml | 13 +++++++++++++ .github/workflows/yaml-check.yml | 5 +++++ 3 files changed, 26 insertions(+) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 5b23ddf77..0758980b6 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -6,6 +6,14 @@ on: - master pull_request: +# Supersede an in-flight run when a PR gets a new push. Keyed on the PR number +# so every push to the same PR shares a group; on a master push the key falls +# back to github.sha (unique per commit) and cancel-in-progress is false, so +# master runs never cancel each other -- each commit is built on its own. +concurrency: + group: ci-build-test-${{ github.event.pull_request.number || github.sha }}-${{ github.repository }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: build-test: runs-on: ubuntu-latest diff --git a/.github/workflows/secscan.yaml b/.github/workflows/secscan.yaml index b5bf8e2be..96daa5afa 100644 --- a/.github/workflows/secscan.yaml +++ b/.github/workflows/secscan.yaml @@ -7,6 +7,19 @@ on: schedule: - cron: '0 0 * * 0' +# `push:` is deliberately unfiltered, so this fires on every push to every +# branch and there is no pull_request event to key on -- the usual +# `github.event.pull_request.number || github.sha` idiom used elsewhere would +# key on the unique-per-commit sha and dedup nothing. Group on the ref instead +# so successive pushes to the same feature branch supersede one another. +# +# Cancelling is safe here: the only output is a SARIF upload, and code scanning +# tracks the latest result per ref, so a superseded scan has nothing to lose. +# master is excluded anyway -- every commit on master gets its own scan. +concurrency: + group: ci-secscan-${{ github.ref }}-${{ github.repository }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} + jobs: tests: runs-on: ubuntu-latest diff --git a/.github/workflows/yaml-check.yml b/.github/workflows/yaml-check.yml index 4a5689e2c..e910ec8d7 100644 --- a/.github/workflows/yaml-check.yml +++ b/.github/workflows/yaml-check.yml @@ -1,6 +1,11 @@ name: 'Yamllint GitHub Actions' on: - pull_request + +concurrency: + group: ci-yamllint-${{ github.event.pull_request.number || github.sha }}-${{ github.repository }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: yamllint: name: 'Yamllint'