From 51a4a720d61e76c91108070fc00b53bb5f31be2c Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Tue, 9 Jun 2020 13:42:22 +0200 Subject: [PATCH] fix: ensure comment removal only when necessary Closes #6469 --- lib/workers/branch/index.spec.ts | 4 ---- lib/workers/branch/index.ts | 13 +++---------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/lib/workers/branch/index.spec.ts b/lib/workers/branch/index.spec.ts index 5d967b747c..55c9ad5ed7 100644 --- a/lib/workers/branch/index.spec.ts +++ b/lib/workers/branch/index.spec.ts @@ -376,7 +376,6 @@ describe('workers/branch', () => { commit.commitFilesToBranch.mockResolvedValueOnce(null); await branchWorker.processBranch(config); expect(platform.ensureComment).toHaveBeenCalledTimes(1); - // expect(platform.ensureCommentRemoval.mock.calls).toHaveLength(0); expect(prWorker.ensurePr).toHaveBeenCalledTimes(1); expect(prWorker.checkAutoMerge).toHaveBeenCalledTimes(0); }); @@ -399,7 +398,6 @@ describe('workers/branch', () => { commit.commitFilesToBranch.mockResolvedValueOnce(null); await branchWorker.processBranch(config); expect(platform.ensureComment).toHaveBeenCalledTimes(1); - // expect(platform.ensureCommentRemoval.mock.calls).toHaveLength(0); expect(prWorker.ensurePr).toHaveBeenCalledTimes(1); expect(prWorker.checkAutoMerge).toHaveBeenCalledTimes(0); }); @@ -422,7 +420,6 @@ describe('workers/branch', () => { commit.commitFilesToBranch.mockResolvedValueOnce(null); await branchWorker.processBranch(config); expect(platform.ensureComment).toHaveBeenCalledTimes(1); - // expect(platform.ensureCommentRemoval.mock.calls).toHaveLength(0); expect(prWorker.ensurePr).toHaveBeenCalledTimes(1); expect(prWorker.checkAutoMerge).toHaveBeenCalledTimes(0); }); @@ -465,7 +462,6 @@ describe('workers/branch', () => { commit.commitFilesToBranch.mockResolvedValueOnce(null); await branchWorker.processBranch(config); expect(platform.ensureComment).toHaveBeenCalledTimes(1); - // expect(platform.ensureCommentRemoval.mock.calls).toHaveLength(0); expect(prWorker.ensurePr).toHaveBeenCalledTimes(1); expect(prWorker.checkAutoMerge).toHaveBeenCalledTimes(0); }); diff --git a/lib/workers/branch/index.ts b/lib/workers/branch/index.ts index 08ce465488..31963c5771 100644 --- a/lib/workers/branch/index.ts +++ b/lib/workers/branch/index.ts @@ -173,6 +173,7 @@ export async function processBranch( branchPr.number ); } else { + // Remove any "PR has been edited" comment only when rebasing await platform.ensureCommentRemoval({ number: branchPr.number, topic, @@ -183,6 +184,7 @@ export async function processBranch( `:construction_worker: This PR has received other commits, so Renovate will stop updating it to avoid conflicts or other problems.` ); content += ` If you wish to abandon your changes and have Renovate start over you may click the "rebase" checkbox in the PR body/description.`; + content += `\n\nIf you think this comment is in error and the branch is *not* modified, try deleting this comment. If it comes back again the next time Renovate runs, please submit an issue or seek config help.`; if (!config.suppressNotifications.includes('prEditNotification')) { if (config.dryRun) { logger.info( @@ -198,11 +200,6 @@ export async function processBranch( } return 'pr-edited'; } - } else { - await platform.ensureCommentRemoval({ - number: branchPr.number, - topic, - }); } } } @@ -613,11 +610,6 @@ export async function processBranch( topic, content, }); - // TODO: remoe this soon once they're all cleared out - await platform.ensureCommentRemoval({ - number: pr.number, - topic: ':warning: Lock file problem', - }); } } const context = `renovate/artifacts`; @@ -651,6 +643,7 @@ export async function processBranch( 'DRY-RUN: Would ensure comment removal in PR #' + pr.number ); } else { + // Remove artifacts error comment only if this run has successfully updated artifacts await platform.ensureCommentRemoval({ number: pr.number, topic }); } } -- GitLab