require-checkout-before-local-action
Rule catalog ID: R025
Targeted pattern scopeโ
GitHub Actions workflow YAML files that use repository-local step actions with uses: ./....
What this rule reportsโ
This rule reports step-level local action references that appear before any actions/checkout step in the same job.
Why this rule existsโ
GitHub's workflow syntax requires checking out the repository before using a local action path. Without that checkout step, the action directory does not exist in the workspace and the workflow will fail at runtime.
โ Incorrectโ
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: ./.github/actions/setup-project
โ Correctโ
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/setup-project
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-checkout-before-local-action": "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.