code: async function getBranchStatus(branchName, requiredStatusChecks) {
    logger.debug(
      `getBranchStatus(${branchName}, requiredStatusChecks=${!!requiredStatusChecks})`
    );
  
    if (!requiredStatusChecks) {
      // null means disable status checks, so it always succeeds
      logger.debug('Status checks disabled = returning "success"');
      return 'success';
    }
  
    const branchCommit = await config.storage.getBranchCommit(branchName);
  
    try {
      const commitStatus = (await api.get(
        `./rest/build-status/1.0/commits/stats/${branchCommit}`
      )).body;
  
      logger.debug({ commitStatus }, 'branch status check result');
  
      if (commitStatus.failed > 0) return 'failed';
      if (commitStatus.inProgress > 0) return 'pending';
      return commitStatus.successful > 0 ? 'success' : 'pending';
    } catch (err) {
      logger.warn({ err }, `Failed to get branch status`);
      return 'failed';
    }
  }
docs: Returns the combined status for a branch. umbrella for status checks https://docs.atlassian.com/bitbucket-server/rest/6.0.0/bitbucket-build-rest.html#idp2