require-dependabot-target-branch
Rule catalog ID: R078
Targeted pattern scopeโ
Dependabot update entries and multi-ecosystem groups that decide where version-update pull requests land.
What this rule reportsโ
This rule reports update entries that do not resolve to a non-empty target-branch.
Why this rule existsโ
Repositories with release trains or stabilization branches often want Dependabot changes routed predictably. Requiring target-branch removes ambiguity and documents the intended update flow directly in configuration.
โ Incorrectโ
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
time: "05:30"
timezone: "UTC"
โ Correctโ
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
time: "05:30"
timezone: "UTC"
target-branch: "main"
Additional examplesโ
This rule is most useful in repositories that validate dependency updates on a dedicated integration branch before merging into the default branch.
ESLint flat config exampleโ
import githubActions from "eslint-plugin-github-actions-2";
export default [githubActions.configs.dependabot];
When not to use itโ
Disable this rule if the repository intentionally wants Dependabot to always use the default branch implicitly.