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'