From e735ed9eb0b55dadba50018f1f1b03aec271dc9b Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Thu, 28 Dec 2017 17:21:06 +0100 Subject: [PATCH] feat: restart renovation if any pr has changed from open to closed --- lib/workers/branch/index.js | 5 ++--- lib/workers/repository/index.js | 2 +- lib/workers/repository/write.js | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/workers/branch/index.js b/lib/workers/branch/index.js index c3f69a4cb7..657299ce31 100644 --- a/lib/workers/branch/index.js +++ b/lib/workers/branch/index.js @@ -68,19 +68,18 @@ async function processBranch(branchConfig) { if (pr.state === 'open') { logger.debug({ pr }, 'Existing PR is open'); if (!pr.canRebase) { - logger.warn('PR has been edited'); - /* const subject = 'PR has been edited'; + logger.info(subject); let content = 'As this PR has been edited, Renovate will stop updating it in order to not cause any conflicts or other problems.'; content += ' If you wish to abandon your edits and have Renovate recreate this PR then you should rename this PR and then close it.'; await platform.ensureComment(pr.number, subject, content); - */ return 'pr-edited'; } } else { logger.warn({ pr }, 'PR state is not open'); + return 'pr-closed'; } } diff --git a/lib/workers/repository/index.js b/lib/workers/repository/index.js index ef6f1ad13f..9dccd72c43 100644 --- a/lib/workers/repository/index.js +++ b/lib/workers/repository/index.js @@ -28,7 +28,7 @@ async function renovateRepository(repoConfig, token, loop = 1) { const res = config.repoIsOnboarded ? await writeUpdates(config) : await ensureOnboardingPr(config); - if (res === 'automerged') { + if (res === 'pr-closed' || res === 'automerged') { logger.info('Restarting repo renovation after automerge'); return renovateRepository(repoConfig, token, loop + 1); } diff --git a/lib/workers/repository/write.js b/lib/workers/repository/write.js index 076f6e0688..749dfd0d8a 100644 --- a/lib/workers/repository/write.js +++ b/lib/workers/repository/write.js @@ -17,9 +17,9 @@ async function writeUpdates(config) { try { for (const branch of branches) { const res = await branchWorker.processBranch({ ...branch, tmpDir }); - if (res === 'automerged') { - // Stop procesing other branches because base branch has been changed by an automerge - return 'automerged'; + if (res === 'pr-closed' || res === 'automerged') { + // Stop procesing other branches because base branch has been changed + return res; } } return 'done'; -- GitLab