require-dependabot-automation-permissions
Rule catalog ID: R111
Targeted pattern scopeโ
Jobs that automate Dependabot pull requests using gh pr edit, gh pr review, or gh pr merge.
What this rule reportsโ
This rule reports missing minimum permissions for Dependabot pull request automation steps.
Why this rule existsโ
PR automation should request only the permissions it actually needs, but it still needs enough privilege to work. This rule makes those minimum permission requirements explicit for common gh pr automation commands.
โ Incorrectโ
permissions:
contents: read
โ Correctโ
permissions:
contents: read
pull-requests: write
issues: write
Additional examplesโ
gh pr edit --add-labelrequiresissues: writegh pr reviewrequirespull-requests: writegh pr mergerequirescontents: writeandpull-requests: write
ESLint flat config exampleโ
import githubActions from "eslint-plugin-github-actions-2";
export default [githubActions.configs.security];
When not to use itโ
Disable this rule if your repository uses a different automation mechanism instead of gh pr commands.