It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Controlling custom Pull Request conditions and test automation outside of the Bitbucket Cloud Edited


Can you please provide guidance on how to achieve the following?

  • Creating custom Pull Request (PR) conditions
  • Controlling the values of the PR conditions outside of Bitbucket through an API
  • Building a custom PR condition on the success of automated tests executed outside of the Bitbucket pipelines (e.g., in a separate Cloud environment or on-premise)

The immediate use-case looks something like this:

  1. git push
  2. Create pull request
  3. In parallel, the following conditions must be satisfied to enable the "Complete Pull Request" button i.e., the gates to allow the Developer to complete the PR:
    1. Must have a code review and the review must pass
    2. Unit tests, executed in the pipeline, must pass
    3. Integration tests, executed outside of the pipeline, must pass

Thank you in advance,


1 answer

0 votes

Hi Matt,

There's three questions here, so I'll answer them individually.

  1. You can create custom PR conditions using the Merge Checks feature in Bitbucket. On each repository, you can define rules for specific branch PRs. 
    Merge checks docs:
  2. You can control these custom PR conditions with the following REST API:
  3. To set PR conditions to prevent merging until automated tests in a separate CI environment are complete, you can use the 'Merge Checks' feature. You'll need to integrate your tool with the build status API so that Bitbucket is aware of the result of your automated tests.
    Merge checks docs:
    Build status API docs:



This answer contains steps that are applicable only for BitBucket Server:

Is there any equivalent for BitBucket cloud?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Atlassian supported Jenkins integration for Bitbucket Server

We’ve been building a plugin to integrate Bitbucket Server and Jenkins CI, and I’m excited to announce that our alpha is ready to download and install. It lets you seamlessly configure a Jenkins job ...

423 views 0 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you