mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 23:16:26 +00:00
fix(github): try/catch getCommitStatus check
This commit is contained in:
parent
4da4c13639
commit
34fbb7c5a7
1 changed files with 13 additions and 1 deletions
|
@ -476,7 +476,19 @@ async function getBranchStatus(branchName, requiredStatusChecks) {
|
||||||
const commitStatusUrl = `repos/${
|
const commitStatusUrl = `repos/${
|
||||||
config.repository
|
config.repository
|
||||||
}/commits/${branchName}/status`;
|
}/commits/${branchName}/status`;
|
||||||
const commitStatus = (await get(commitStatusUrl)).body;
|
let commitStatus;
|
||||||
|
try {
|
||||||
|
commitStatus = (await get(commitStatusUrl)).body;
|
||||||
|
} catch (err) /* istanbul ignore next */ {
|
||||||
|
if (err.statusCode === 404) {
|
||||||
|
logger.info(
|
||||||
|
'Received 404 when checking branch status, assuming that branch has been deleted'
|
||||||
|
);
|
||||||
|
throw new Error('repository-changed');
|
||||||
|
}
|
||||||
|
logger.info('Unknown error when checking branch status');
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
logger.debug(
|
logger.debug(
|
||||||
{ state: commitStatus.state, statuses: commitStatus.statuses },
|
{ state: commitStatus.state, statuses: commitStatus.statuses },
|
||||||
'branch status check result'
|
'branch status check result'
|
||||||
|
|
Loading…
Reference in a new issue