mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 14:36:25 +00:00
fix(github): fix github status check (#5905)
This commit is contained in:
parent
b45101b753
commit
5a3359462c
2 changed files with 12 additions and 9 deletions
|
@ -640,7 +640,7 @@ describe('platform/github', () => {
|
|||
() =>
|
||||
({
|
||||
body: {
|
||||
state: 'failed',
|
||||
state: 'failure',
|
||||
},
|
||||
} as any)
|
||||
);
|
||||
|
@ -690,7 +690,7 @@ describe('platform/github', () => {
|
|||
{
|
||||
id: 23950195,
|
||||
status: 'completed',
|
||||
conclusion: 'failed',
|
||||
conclusion: 'failure',
|
||||
name: 'Travis CI - Branch',
|
||||
},
|
||||
],
|
||||
|
@ -796,7 +796,7 @@ describe('platform/github', () => {
|
|||
},
|
||||
{
|
||||
context: 'context-3',
|
||||
state: 'failed',
|
||||
state: 'failure',
|
||||
},
|
||||
],
|
||||
} as any)
|
||||
|
@ -825,7 +825,7 @@ describe('platform/github', () => {
|
|||
},
|
||||
{
|
||||
context: 'context-3',
|
||||
state: 'failed',
|
||||
state: 'error',
|
||||
},
|
||||
],
|
||||
} as any)
|
||||
|
|
|
@ -1057,11 +1057,13 @@ export async function getBranchPr(branchName: string): Promise<Pr | null> {
|
|||
return existingPr ? getPr(existingPr.number) : null;
|
||||
}
|
||||
|
||||
// https://developer.github.com/v3/repos/statuses
|
||||
// https://developer.github.com/v3/checks/runs/
|
||||
type BranchState = 'failure' | 'pending' | 'success';
|
||||
|
||||
interface GhBranchStatus {
|
||||
context: string;
|
||||
state: BranchState;
|
||||
state: BranchState | 'error';
|
||||
}
|
||||
|
||||
interface CombinedBranchStatus {
|
||||
|
@ -1156,14 +1158,14 @@ export async function getBranchStatus(
|
|||
if (commitStatus.state === 'success') {
|
||||
return BranchStatus.green;
|
||||
}
|
||||
if (commitStatus.state === 'failed') {
|
||||
if (commitStatus.state === 'failure') {
|
||||
return BranchStatus.red;
|
||||
}
|
||||
return BranchStatus.yellow;
|
||||
}
|
||||
if (
|
||||
commitStatus.state === 'failed' ||
|
||||
checkRuns.some(run => run.conclusion === 'failed')
|
||||
commitStatus.state === 'failure' ||
|
||||
checkRuns.some(run => run.conclusion === 'failure')
|
||||
) {
|
||||
return BranchStatus.red;
|
||||
}
|
||||
|
@ -1189,7 +1191,8 @@ async function getStatusCheck(
|
|||
|
||||
const githubToRenovateStatusMapping = {
|
||||
success: BranchStatus.green,
|
||||
failed: BranchStatus.red,
|
||||
error: BranchStatus.red,
|
||||
failure: BranchStatus.red,
|
||||
pending: BranchStatus.yellow,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue