Skip to content
Snippets Groups Projects
Commit 51a4a720 authored by Rhys Arkins's avatar Rhys Arkins
Browse files

fix: ensure comment removal only when necessary

Closes #6469
parent 5a87c8b7
No related branches found
No related tags found
No related merge requests found
...@@ -376,7 +376,6 @@ describe('workers/branch', () => { ...@@ -376,7 +376,6 @@ describe('workers/branch', () => {
commit.commitFilesToBranch.mockResolvedValueOnce(null); commit.commitFilesToBranch.mockResolvedValueOnce(null);
await branchWorker.processBranch(config); await branchWorker.processBranch(config);
expect(platform.ensureComment).toHaveBeenCalledTimes(1); expect(platform.ensureComment).toHaveBeenCalledTimes(1);
// expect(platform.ensureCommentRemoval.mock.calls).toHaveLength(0);
expect(prWorker.ensurePr).toHaveBeenCalledTimes(1); expect(prWorker.ensurePr).toHaveBeenCalledTimes(1);
expect(prWorker.checkAutoMerge).toHaveBeenCalledTimes(0); expect(prWorker.checkAutoMerge).toHaveBeenCalledTimes(0);
}); });
...@@ -399,7 +398,6 @@ describe('workers/branch', () => { ...@@ -399,7 +398,6 @@ describe('workers/branch', () => {
commit.commitFilesToBranch.mockResolvedValueOnce(null); commit.commitFilesToBranch.mockResolvedValueOnce(null);
await branchWorker.processBranch(config); await branchWorker.processBranch(config);
expect(platform.ensureComment).toHaveBeenCalledTimes(1); expect(platform.ensureComment).toHaveBeenCalledTimes(1);
// expect(platform.ensureCommentRemoval.mock.calls).toHaveLength(0);
expect(prWorker.ensurePr).toHaveBeenCalledTimes(1); expect(prWorker.ensurePr).toHaveBeenCalledTimes(1);
expect(prWorker.checkAutoMerge).toHaveBeenCalledTimes(0); expect(prWorker.checkAutoMerge).toHaveBeenCalledTimes(0);
}); });
...@@ -422,7 +420,6 @@ describe('workers/branch', () => { ...@@ -422,7 +420,6 @@ describe('workers/branch', () => {
commit.commitFilesToBranch.mockResolvedValueOnce(null); commit.commitFilesToBranch.mockResolvedValueOnce(null);
await branchWorker.processBranch(config); await branchWorker.processBranch(config);
expect(platform.ensureComment).toHaveBeenCalledTimes(1); expect(platform.ensureComment).toHaveBeenCalledTimes(1);
// expect(platform.ensureCommentRemoval.mock.calls).toHaveLength(0);
expect(prWorker.ensurePr).toHaveBeenCalledTimes(1); expect(prWorker.ensurePr).toHaveBeenCalledTimes(1);
expect(prWorker.checkAutoMerge).toHaveBeenCalledTimes(0); expect(prWorker.checkAutoMerge).toHaveBeenCalledTimes(0);
}); });
...@@ -465,7 +462,6 @@ describe('workers/branch', () => { ...@@ -465,7 +462,6 @@ describe('workers/branch', () => {
commit.commitFilesToBranch.mockResolvedValueOnce(null); commit.commitFilesToBranch.mockResolvedValueOnce(null);
await branchWorker.processBranch(config); await branchWorker.processBranch(config);
expect(platform.ensureComment).toHaveBeenCalledTimes(1); expect(platform.ensureComment).toHaveBeenCalledTimes(1);
// expect(platform.ensureCommentRemoval.mock.calls).toHaveLength(0);
expect(prWorker.ensurePr).toHaveBeenCalledTimes(1); expect(prWorker.ensurePr).toHaveBeenCalledTimes(1);
expect(prWorker.checkAutoMerge).toHaveBeenCalledTimes(0); expect(prWorker.checkAutoMerge).toHaveBeenCalledTimes(0);
}); });
......
...@@ -173,6 +173,7 @@ export async function processBranch( ...@@ -173,6 +173,7 @@ export async function processBranch(
branchPr.number branchPr.number
); );
} else { } else {
// Remove any "PR has been edited" comment only when rebasing
await platform.ensureCommentRemoval({ await platform.ensureCommentRemoval({
number: branchPr.number, number: branchPr.number,
topic, topic,
...@@ -183,6 +184,7 @@ export async function processBranch( ...@@ -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.` `: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 += ` 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.suppressNotifications.includes('prEditNotification')) {
if (config.dryRun) { if (config.dryRun) {
logger.info( logger.info(
...@@ -198,11 +200,6 @@ export async function processBranch( ...@@ -198,11 +200,6 @@ export async function processBranch(
} }
return 'pr-edited'; return 'pr-edited';
} }
} else {
await platform.ensureCommentRemoval({
number: branchPr.number,
topic,
});
} }
} }
} }
...@@ -613,11 +610,6 @@ export async function processBranch( ...@@ -613,11 +610,6 @@ export async function processBranch(
topic, topic,
content, 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`; const context = `renovate/artifacts`;
...@@ -651,6 +643,7 @@ export async function processBranch( ...@@ -651,6 +643,7 @@ export async function processBranch(
'DRY-RUN: Would ensure comment removal in PR #' + pr.number 'DRY-RUN: Would ensure comment removal in PR #' + pr.number
); );
} else { } else {
// Remove artifacts error comment only if this run has successfully updated artifacts
await platform.ensureCommentRemoval({ number: pr.number, topic }); await platform.ensureCommentRemoval({ number: pr.number, topic });
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment