From Simple to Advanced: Boolean Merge-Check Expressions for Bitbucket
From Simple to Advanced: Boolean Merge-Check Expressions for Bitbucket
Pull request merge checks are a godsend for larger teams that need a thorough review process. But an approval policy can become too rigid when one reviewer is on leave and another is already enjoying their weekend in a different time zone. Before long, you’re chasing approvals instead of shipping a change.
Boolean merge-check expressions let Workzone for Bitbucket Data Center combine approval, signature and build requirements using AND (&), OR (|) and parentheses. That means you can define alternative authorised paths to approval while keeping non-negotiable checks in place.
From a simple checklist to flexible merge conditions
A simple merge policy might require successful builds AND reviewer approvals AND digital signatures. Every condition must be satisfied. This works well until a team needs a policy such as: a PR may proceed after either a percentage of all reviewers or a defined quota from every reviewer group has approved.
Here’s the advanced Workzone expression from the original example:
requiredBuildsCount > 1 &
(approvalQuota >= 50% | groupQuota >= 2) &
requiredSignaturesCount > 2
It means the pull request needs all three of the following:
- At least two successful build results (
requiredBuildsCount > 1). - Either at least 50% of assigned reviewers have approved or at least two members of each configured reviewer group have approved.
- At least three signed approvals (
requiredSignaturesCount > 2).
The parentheses matter. The OR applies only to the two review-approval options; the builds and signatures remain required whichever option succeeds. Workzone evaluates the reported build results for the source branch’s current HEAD.

A more unusual example: the Royal Family exception
Here’s the original article’s less conventional example:
(requiredBuildsCount > 0 & groupQuota >= 2) |
groupQuota['royal-family-members'] > 0
In this expression, a pull request can satisfy the rule through at least one successful build plus two approvals per configured reviewer group, or through at least one approval from the named royal-family-members group.
So, if a member of the Royal Family approves, the build requirement in the other branch of this expression is no longer required. That’s certainly flexible—although we wouldn’t recommend making it your production release policy!
Important: OR can unintentionally bypass safeguards if you put mandatory requirements on only one side of it. The expression also doesn’t override every other independent Bitbucket merge check or Workzone control. Named groups must exist in the Workzone reviewer configuration.
If a successful build should always be required, put it outside the OR:
requiredBuildsCount > 0 &
(groupQuota >= 2 | groupQuota['release-managers'] > 0)
Now both approval routes require a successful build. The policy allows an alternative reviewer-group route, but not an alternative to the build gate. Whether such an exception is appropriate depends on your organisation’s own review policy.
A few things to check before enabling the rule
Keep your Boolean policy readable, verify that named groups and reviewer quotas are configured, and test the possible outcomes against a sample PR—especially an approval that should not be enough to merge. Workzone also supports file/path-specific reviewer quotas, which may be evaluated in addition to the written expression; check their interaction before introducing exceptions.
Bitbucket Data Center already includes native merge checks for minimum approvals, builds, incomplete tasks and other conditions. Workzone’s Boolean expressions add the ability to express alternative, grouped approval logic within its advanced merge configuration—not a replacement for every native safeguard.
Workzone Cloud is different: its merge configuration uses simple AND-combined conditions and does not support the Data Center Boolean-expression syntax or OR branches. See the Workzone Cloud migration feature comparison before attempting to reproduce a Data Center rule in Cloud.
For the full syntax and more group-specific examples, see Workzone: Advanced Merge Conditions.
Want more flexible merge rules in Bitbucket Data Center?
If your team needs conditional approval paths, named reviewer-group quotas and build or signature requirements, explore Workzone for Bitbucket Data Center on the Atlassian Marketplace to see how advanced merge control can support your pull request workflow.
By Sean Manwarring, Head of Marketing at Izymes
Published 14 September 2022 · Updated 26 October 2026