require-bitbucket-pipelines-pull-requests-target-branches
Require target branch mappings under pull-requests in
bitbucket-pipelines.yml.
Targeted pattern scopeâ
This rule checks bitbucket-pipelines.yml and ensures each pull-requests:
block declares at least one target branch pattern key.
What this rule reportsâ
This rule reports when pull-requests: exists but has no target branch
mappings (for example, missing keys such as "**":).
Why this rule existsâ
Bitbucket Pipelines pull-requests configuration is branch-pattern keyed.
Without a target branch mapping, pull request pipelines are not explicitly
defined for any destination branch.
â Incorrectâ
pipelines:
pull-requests:
â Correctâ
pipelines:
pull-requests:
"**":
- step:
name: Validate pull requests
script:
- npm test
ESLint flat config exampleâ
import repoPlugin from "eslint-plugin-repo";
export default [
repoPlugin.configs.bitbucket,
{
plugins: { "repo-compliance": repoPlugin },
rules: {
"repo-compliance/require-bitbucket-pipelines-pull-requests-target-branches": "warn",
},
},
];
When not to use itâ
Disable this rule if you intentionally omit pull request pipeline execution in Bitbucket Cloud.
Rule catalog ID: R049