Missing concurrency group on PR workflow¶
Rule ID |
|
|---|---|
Category |
reliability |
Severity |
medium |
PR-triggered workflow has no concurrency group. Multiple pushes to the same PR will queue redundant runs instead of cancelling the previous one.
Detection¶
static_analysis — Checks field presence or value in the workflow YAML.
Examples¶
Non-compliant:
on:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: npm test
Compliant:
on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: npm test
Fix: Add a top-level concurrency block with a group key that includes github.ref and set cancel-in-progress: true to cancel superseded runs automatically.