prefer-fail-fast
Rule catalog ID: R015
Targeted pattern scopeโ
GitHub Actions workflow YAML files that use matrix strategies.
What this rule reportsโ
This rule reports jobs that explicitly set strategy.fail-fast to false.
Why this rule existsโ
Leaving fail-fast enabled can save runner time and reduce queue pressure when one matrix job already proves the matrix is failing.
โ Incorrectโ
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: [20, 22]
โ Correctโ
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
node: [20, 22]
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/prefer-fail-fast": "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.