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

  1. Sign in to Bitbucket at https://bitbucket.org.

  2. Navigate to Repository Settings → Branch Restrictions.

  3. Confirm Bitbucket Pipelines is enabled, or an external CI tool is integrated and posting build statuses.

  4. Locate the restriction configured for the default branch (or *, if scoped to all branches).

  5. Review the Merge Checks section.

  6. 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

  1. Sign in to Bitbucket at https://bitbucket.org.

  2. Navigate to the target repository.

  3. Select Repository Settings.

  1. Open Branch Restrictions.

  1. Edit or create a branch restriction for the default branch.

  2. In the branch Restriction, select by branch name or pattern add “*” value (it will include all branches).

  1. Under Merge Checks, enable:

  2. Minimum number of successful builds for the last commit with no failed builds and no in progress builds

  1. Set the required value to 1 or greater.

  2. Save the configuration.

Backout Plan

  1. Sign in to Bitbucket at https://bitbucket.org.

  2. Navigate to Repository Settings.

  3. Open Branch Restrictions.

  4. Edit the branch restriction associated with the default branch.

  5. Disable the minimum number of successful builds for the last commit with no failed builds and no in-progress builds.

  6. Save the changes.

  7. Confirm that repository operations are normal after the rollback.

Reference