How to Run Pull Request Pipelines in Bitbucket Pipelines
The pull-requests section triggers on PR activity and runs against a temporary merge of source and target, so checks reflect the merged result.
Add a pull-requests: section keyed by source branch glob. Pipelines runs it when a matching PR is created or updated, merging in the destination branch first.
Steps
- Add
pull-requests:underpipelines. - Key it by source branch (use
**for all branches). - List the checks you want to gate the merge.
bitbucket-pipelines.yml
bitbucket-pipelines.yml
pipelines:
pull-requests:
'**':
- step:
name: PR checks
script:
- npm ci
- npm run lint
- npm testGotchas
- If a push matches both
branchesandpull-requests, the pull-request pipeline takes priority while a PR is open. - The merge check is skipped when the PR has conflicts; Pipelines then builds the source branch as-is.
Related guides
How to Configure Branch-Specific Pipelines in Bitbucket PipelinesRun different Bitbucket Pipelines steps per branch with the branches section, matching exact names or glob pa…
How to Run Steps Only on Changed Files in Bitbucket PipelinesSkip a Bitbucket Pipelines step unless matching files changed using condition with changesets includePaths, a…