diff --git a/lib/workers/repository/error-config.js b/lib/workers/repository/error-config.js index ca65c6477a1dc75222877b88fa75d489ac9039cc..c203df361f51f875744cd2d4468279f49fb9e59c 100644 --- a/lib/workers/repository/error-config.js +++ b/lib/workers/repository/error-config.js @@ -12,7 +12,13 @@ async function raiseConfigWarningIssue(config, error) { if (error.validationMessage) { body += `Message: ${error.validationMessage}\n`; } - if (config.repoIsOnboarded) { + const pr = await platform.getBranchPr('renovate/configure'); + if (pr && pr.state && pr.state.startsWith('open')) { + logger.info('Updating onboarding PR with config error notice'); + body = `## Action Required: Fix Renovate Configuration\n\n${body}`; + body += `\n\nOnce you have resolved this problem (in this onboarding branch), Renovate will return to providing you with a preview of your repository's configuration.`; + await platform.updatePr(pr.number, 'Configure Renovate', body); + } else { const res = await platform.ensureIssue( 'Action Required: Fix Renovate Configuration', body @@ -20,12 +26,5 @@ async function raiseConfigWarningIssue(config, error) { if (res) { logger.warn({ configError: error, res }, 'Config Warning'); } - } else { - // update onboarding Pr - logger.info('Updating onboarding PR'); - const pr = await platform.getBranchPr('renovate/configure'); - body = `## Action Required: Fix Renovate Configuration\n\n${body}`; - body += `\n\nOnce you have resolved this problem (in this onboarding branch), Renovate will return to providing you with a preview of your repository's configuration.`; - await platform.updatePr(pr.number, 'Configure Renovate', body); } } diff --git a/test/workers/repository/error-config.spec.js b/test/workers/repository/error-config.spec.js index b07b791d58e07b1da75d7e954cec94bfdcd7d9ec..222d49626aa841f2c8b885b777770e8f276ced6b 100644 --- a/test/workers/repository/error-config.spec.js +++ b/test/workers/repository/error-config.spec.js @@ -14,7 +14,6 @@ describe('workers/repository/error-config', () => { const error = new Error('config-validation'); error.configFile = 'package.json'; error.validationMessage = 'some-message'; - config.repoIsOnboarded = true; platform.ensureIssue.mockReturnValue('created'); const res = await raiseConfigWarningIssue(config, error); expect(res).toBeUndefined(); @@ -23,8 +22,7 @@ describe('workers/repository/error-config', () => { const error = new Error('config-validation'); error.configFile = 'package.json'; error.validationMessage = 'some-message'; - config.repoIsOnboarded = false; - platform.getBranchPr.mockReturnValueOnce({ number: 1 }); + platform.getBranchPr.mockReturnValueOnce({ number: 1, state: 'open' }); const res = await raiseConfigWarningIssue(config, error); expect(res).toBeUndefined(); });