require-workflow-concurrency
Rule catalog ID: R004
Targeted pattern scopeโ
Workflows that listen for push, pull_request, pull_request_target, workflow_dispatch, or merge_group by default.
What this rule reportsโ
This rule reports workflows that should define top-level concurrency but do not, as well as concurrency blocks that omit group or cancel-in-progress.
Why this rule existsโ
Concurrency helps cancel superseded runs so repeated pushes and pull request updates do not create long backlogs of redundant workflow executions.
โ Incorrectโ
on:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
concurrency:
group: ci
โ Correctโ
on:
pull_request:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
Additional examplesโ
For larger repositories, this rule is often enabled together with one of the published presets so violations are caught in pull requests before workflow changes are merged.
ESLint flat config exampleโ
import githubActions from "eslint-plugin-github-actions-2";
export default [
{
files: ["**/*.{yml,yaml}"],
plugins: {
"github-actions": githubActions,
},
rules: {
"github-actions/require-workflow-concurrency": "error",
},
},
];
When not to use itโ
You can disable this rule when its policy does not match your repository standards, or when equivalent enforcement is already handled by another policy tool.