* 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)
| 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?'})) { |
nothing calls this directly
no test coverage detected