Description
This check verifies that Bitbucket requires successful status checks (such as CI/CD pipeline builds, automated tests, or quality gates) before a pull request can be merged. This ensures that code changes are validated and meet defined quality standards prior to integration.
Note: Only repository-level branch restrictions are detected. Restrictions set only at the project level are not returned by Bitbucket’s API and will result in a FAIL. Configure the restriction at the repository level for accurate results.
Rationale
Status checks help verify that code changes have passed automated validation processes, including builds, tests, and security scans. Requiring successful status checks before merge reduces the risk of introducing defective, unstable, or insecure code into protected branches.
Impact
Prevent pull requests from being merged when validation checks fail.
Increase merge times while builds and tests complete.
Improve code quality and reliability.
Reduce the likelihood of production issues caused by untested code.
Default Value
Disabled By default, Bitbucket does not require successful builds or status checks before pull requests can be merged. Repository administrators must explicitly configure merge checks.
Pre-Requisites
Access to the repository
An existing Bitbucket repository
Test Plan
Sign in to Bitbucket at https://bitbucket.org.
Navigate to Repository Settings → Branch Restrictions.
Confirm Bitbucket Pipelines is enabled, or an external CI tool is integrated and posting build statuses.
Locate the restriction configured for the default branch (or *, if scoped to all branches).
Review the Merge Checks section.
Verify "Minimum number of successful builds for the last commit with no failed builds and no in progress builds" is enabled, with value ≥ 1.
Implementation Steps
Sign in to Bitbucket at https://bitbucket.org.
Navigate to the target repository.
Select Repository Settings.
Open Branch Restrictions.
Edit or create a branch restriction for the default branch.
In the branch Restriction, select by branch name or pattern add “*” value (it will include all branches).
Under Merge Checks, enable:
Minimum number of successful builds for the last commit with no failed builds and no in progress builds
Set the required value to 1 or greater.
Save the configuration.
Backout Plan
Sign in to Bitbucket at https://bitbucket.org.
Navigate to Repository Settings.
Open Branch Restrictions.
Edit the branch restriction associated with the default branch.
Disable the minimum number of successful builds for the last commit with no failed builds and no in-progress builds.
Save the changes.
Confirm that repository operations are normal after the rollback.
Reference
https://support.atlassian.com/bitbucket-cloud/docs/checks-for-merging-pull-requests/
https://support.atlassian.com/bitbucket-cloud/docs/use-branch-permissions/
https://support.atlassian.com/bitbucket-cloud/docs/work-with-pull-requests/
https://support.atlassian.com/bitbucket-cloud/docs/configure-a-projects-merge-strategies-and-checks/