diff --git a/lib/workers/repository/finalise/validate.js b/lib/workers/repository/finalise/validate.js index 1d4848331ed095082b495acbb556e37a97e9a22e..2ae1720b86ddaea122380fc4a28ed3a9bd426cdc 100644 --- a/lib/workers/repository/finalise/validate.js +++ b/lib/workers/repository/finalise/validate.js @@ -36,7 +36,12 @@ async function validatePrs(config) { 'PR has renovate files' ); for (const file of renovateFiles) { - const content = await platform.getFile(file, pr.sha || pr.branchName); + let content; + try { + content = await platform.getFile(file, pr.sha || pr.branchName); + } catch (err) /* istanbul ignore next */ { + content = await platform.getFile(file, pr.branchName); + } let parsed; try { parsed = JSON.parse(content); @@ -95,14 +100,19 @@ async function validatePrs(config) { logger.debug('Skipping branch status for forked PR'); } } catch (err) { - logger.warn( - { - err, - prNo: pr.number, - branchName: pr.branchName, - }, - 'Error checking PR' - ); + // istanbul ignore if + if (err.message === 'repository-changed') { + logger.info('Cannot access PR files to check them'); + } else { + logger.warn( + { + err, + prNo: pr.number, + branchName: pr.branchName, + }, + 'Error checking PR' + ); + } } } }