protected async verifyPassingGithubStatus()

in ng-dev/release/publish/actions.ts [118:162]


  protected async verifyPassingGithubStatus(branchName: string) {
    const commitSha = await this._getCommitOfBranch(branchName);
    const {
      data: {state},
    } = await this.git.github.repos.getCombinedStatusForRef({
      ...this.git.remoteParams,
      ref: commitSha,
    });
    const branchCommitsUrl = getListCommitsInBranchUrl(this.git, branchName);

    if (state === 'failure') {
      error(
        red(
          `  ✘   Cannot stage release. Commit "${commitSha}" does not pass all github ` +
            'status checks. Please make sure this commit passes all checks before re-running.',
        ),
      );
      error(`      Please have a look at: ${branchCommitsUrl}`);

      if (await promptConfirm('Do you want to ignore the Github status and proceed?')) {
        info(
          yellow(
            '  ⚠   Upstream commit is failing CI checks, but status has been forcibly ignored.',
          ),
        );
        return;
      }
      throw new UserAbortedReleaseActionError();
    } else if (state === 'pending') {
      error(
        red(
          `  ✘   Commit "${commitSha}" still has pending github statuses that ` +
            'need to succeed before staging a release.',
        ),
      );
      error(red(`      Please have a look at: ${branchCommitsUrl}`));
      if (await promptConfirm('Do you want to ignore the Github status and proceed?')) {
        info(yellow('  ⚠   Upstream commit is pending CI, but status has been forcibly ignored.'));
        return;
      }
      throw new UserAbortedReleaseActionError();
    }

    info(green('  ✓   Upstream commit is passing all github status checks.'));
  }