mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 22:46:27 +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: {
|
body: {
|
||||||
state: 'failed',
|
state: 'failure',
|
||||||
},
|
},
|
||||||
} as any)
|
} as any)
|
||||||
);
|
);
|
||||||
|
@ -690,7 +690,7 @@ describe('platform/github', () => {
|
||||||
{
|
{
|
||||||
id: 23950195,
|
id: 23950195,
|
||||||
status: 'completed',
|
status: 'completed',
|
||||||
conclusion: 'failed',
|
conclusion: 'failure',
|
||||||
name: 'Travis CI - Branch',
|
name: 'Travis CI - Branch',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -796,7 +796,7 @@ describe('platform/github', () => {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
context: 'context-3',
|
context: 'context-3',
|
||||||
state: 'failed',
|
state: 'failure',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
} as any)
|
} as any)
|
||||||
|
@ -825,7 +825,7 @@ describe('platform/github', () => {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
context: 'context-3',
|
context: 'context-3',
|
||||||
state: 'failed',
|
state: 'error',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
} as any)
|
} as any)
|
||||||
|
|
|
@ -1057,11 +1057,13 @@ export async function getBranchPr(branchName: string): Promise<Pr | null> {
|
||||||
return existingPr ? getPr(existingPr.number) : 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';
|
type BranchState = 'failure' | 'pending' | 'success';
|
||||||
|
|
||||||
interface GhBranchStatus {
|
interface GhBranchStatus {
|
||||||
context: string;
|
context: string;
|
||||||
state: BranchState;
|
state: BranchState | 'error';
|
||||||
}
|
}
|
||||||
|
|
||||||
interface CombinedBranchStatus {
|
interface CombinedBranchStatus {
|
||||||
|
@ -1156,14 +1158,14 @@ export async function getBranchStatus(
|
||||||
if (commitStatus.state === 'success') {
|
if (commitStatus.state === 'success') {
|
||||||
return BranchStatus.green;
|
return BranchStatus.green;
|
||||||
}
|
}
|
||||||
if (commitStatus.state === 'failed') {
|
if (commitStatus.state === 'failure') {
|
||||||
return BranchStatus.red;
|
return BranchStatus.red;
|
||||||
}
|
}
|
||||||
return BranchStatus.yellow;
|
return BranchStatus.yellow;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
commitStatus.state === 'failed' ||
|
commitStatus.state === 'failure' ||
|
||||||
checkRuns.some(run => run.conclusion === 'failed')
|
checkRuns.some(run => run.conclusion === 'failure')
|
||||||
) {
|
) {
|
||||||
return BranchStatus.red;
|
return BranchStatus.red;
|
||||||
}
|
}
|
||||||
|
@ -1189,7 +1191,8 @@ async function getStatusCheck(
|
||||||
|
|
||||||
const githubToRenovateStatusMapping = {
|
const githubToRenovateStatusMapping = {
|
||||||
success: BranchStatus.green,
|
success: BranchStatus.green,
|
||||||
failed: BranchStatus.red,
|
error: BranchStatus.red,
|
||||||
|
failure: BranchStatus.red,
|
||||||
pending: BranchStatus.yellow,
|
pending: BranchStatus.yellow,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue