require-forgejo-actions-concurrency
Require a concurrency: key in all Forgejo Actions workflow files.
Targeted pattern scopeâ
This rule scans .forgejo/workflows/*.{yml,yaml} and requires each workflow file
to contain a top-level concurrency: key.
What this rule reportsâ
This rule reports Forgejo workflow files that do not include a concurrency: block.
Why this rule existsâ
Without concurrency control, pushing multiple commits in quick succession will
queue up a new pipeline run for each push, even when earlier runs are no longer
relevant. This wastes CI minutes and can produce confusing interleaved status
updates. A concurrency block with cancel-in-progress: true ensures that only
the latest run continues when a new commit supersedes a prior one.
â Incorrectâ
name: CI
on:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: npm test
â Correctâ
name: CI
on:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: npm test
ESLint flat config exampleâ
import repoPlugin from "eslint-plugin-repo";
export default [
repoPlugin.configs.codeberg,
{
plugins: { "repo-compliance": repoPlugin },
rules: {
"repo-compliance/require-forgejo-actions-concurrency": "warn",
},
},
];
When not to use itâ
Disable this rule for workflows where concurrent runs are intentional â for example, scheduled jobs that should not cancel each other, or release workflows where only one run is typically active at a time and cancellation would be destructive.
Rule catalog ID: R060