MCPcopy Create free account
hub / github.com/angular/dev-infra / assertPassingGithubStatus

Function assertPassingGithubStatus

ng-dev/release/publish/actions.ts:179–214  ·  view source on GitHub ↗

* Verifies that the given commit has passing all statuses. * * Upon error, a link to the branch containing the commit is printed, * allowing the caretaker to quickly inspect the GitHub commit status failures.

(commitSha: string, branchNameForError: string)

Source from the content-addressed store, hash-verified

177 protected async getLatestCommitOfBranch(branchName: string): Promise<Commit> {
178 const {
179 data: {commit},
180 } = await this.git.github.repos.getBranch({...this.git.remoteParams, branch: branchName});
181 return commit;
182 }
183
184 /**
185 * Verifies that the given commit has passing all statuses.
186 *
187 * Upon error, a link to the branch containing the commit is printed,
188 * allowing the caretaker to quickly inspect the GitHub commit status failures.
189 */
190 protected async assertPassingGithubStatus(commitSha: string, branchNameForError: string) {
191 const {result} = await githubMacros.getCombinedChecksAndStatusesForRef(this.git.github, {
192 ...this.git.remoteParams,
193 ref: commitSha,
194 });
195 const branchCommitsUrl = getListCommitsInBranchUrl(this.git, branchNameForError);
196
197 if (result === 'failing' || result === null) {
198 Log.error(
199 ` ✘ Cannot stage release. Commit "${commitSha}" does not pass all github ` +
200 'status checks. Please make sure this commit passes all checks before re-running.',
201 );
202 Log.error(` Please have a look at: ${branchCommitsUrl}`);
203
204 if (await Prompt.confirm({message: 'Do you want to ignore the Github status and proceed?'})) {
205 Log.warn(
206 ' ⚠ Upstream commit is failing CI checks, but status has been forcibly ignored.',
207 );
208 return;
209 }
210 throw new UserAbortedReleaseActionError();
211 } else if (result === 'pending') {
212 Log.error(
213 ` ✘ Commit "${commitSha}" still has pending github statuses that ` +
214 'need to succeed before staging a release.',
215 );
216 Log.error(` Please have a look at: ${branchCommitsUrl}`);
217 if (await Prompt.confirm({message: 'Do you want to ignore the Github status and proceed?'})) {

Callers

nothing calls this directly

Calls 2

errorMethod · 0.45

Tested by

no test coverage detected