Skip to content
Latchkey

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: under pipelines.
  • 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 test

Gotchas

  • If a push matches both branches and pull-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

Run this faster and cheaper on Latchkey managed runners. Start free →