diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts index be95b54da7c599486a4824c2a8d28313dc770ebe..f4ef1496960c03352e4dc70a63d49588ab35abc0 100644 --- a/lib/platform/github/index.ts +++ b/lib/platform/github/index.ts @@ -651,13 +651,21 @@ export async function getBranchStatusCheck( ) { const branchCommit = await config.storage.getBranchCommit(branchName); const url = `repos/${config.repository}/commits/${branchCommit}/statuses`; - const res = await api.get(url); - for (const check of res.body) { - if (check.context === context) { - return check.state; + try { + const res = await api.get(url); + for (const check of res.body) { + if (check.context === context) { + return check.state; + } } + return null; + } catch (err) /* istanbul ignore next */ { + if (err.statusCode === 404) { + logger.info('Commit not found when checking statuses'); + throw new Error('repository-changed'); + } + throw err; } - return null; } export async function setBranchStatus(