Conditional Merge Check

Allows you to specify a condition that will cause a pull request merge to be vetoed when evaluated as 'true'.

Here is an example of a condition that will block a pull request merge if one of the reviewers marks the pull request as needing more work. You can find this example if you click Show snippets under the condition field and select the At least one reviewer has marked the pull request as needs more work snippet.

import com.atlassian.bitbucket.pull.PullRequestParticipantStatus

def reviewers = mergeRequest.pullRequest.reviewers

reviewers.any { it.status == PullRequestParticipantStatus.NEEDS_WORK }

Also, note that a custom 'veto message' can also be set when specifying a conditional merge check, which will be displayed to the user whose merge is being prevented.