require-bitbucket-pipelines-pull-requests
Require a pull-requests: section in Bitbucket Pipelines.
Targeted pattern scopeâ
This rule checks bitbucket-pipelines.yml (or bitbucket-pipelines.yaml) and verifies that the configuration includes a pull-requests: section.
What this rule reportsâ
This rule reports repositories with Bitbucket Pipelines configured but no pull-request-specific pipeline configuration.
Why this rule existsâ
Atlassian documents pipelines.pull-requests as the mechanism to run pipelines on PR updates. Enforcing it provides explicit pre-merge validation coverage and reduces reliance on branch-only triggers.
â Incorrectâ
// bitbucket-pipelines.yml
image: node:22
pipelines:
default:
- step:
script:
- npm test
â Correctâ
// bitbucket-pipelines.yml
image: node:22
pipelines:
pull-requests:
"**":
- step:
script:
- npm test
default:
- step:
script:
- npm run lint
ESLint flat config exampleâ
// eslint.config.mjs
import repoPlugin from "eslint-plugin-repo";
export default [
repoPlugin.configs.bitbucket,
{
plugins: { "repo-compliance": repoPlugin },
rules: {
"repo-compliance/require-bitbucket-pipelines-pull-requests": "error",
},
},
];
When not to use itâ
Disable this rule only if your team intentionally runs all PR validation through an external CI integration and does not use Bitbucket pull-request pipeline triggers.
Rule catalog ID: R023
Further readingâ
Adoption resourcesâ
- Enable
repo-compliance:bitbucketpreset to enforce this rule with other Bitbucket provider checks. - Combine with
require-bitbucket-pipelines-default-pipelineto ensure both general branch and PR coverage.