mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 22:46:27 +00:00
feat(pr): remove and re-create automergeComment when rebasing (#6002)
This commit is contained in:
parent
957980051f
commit
8144f07b69
2 changed files with 19 additions and 0 deletions
|
@ -85,6 +85,18 @@ describe('workers/pr', () => {
|
|||
pr.isModified = false;
|
||||
platform.getBranchStatus.mockResolvedValueOnce(BranchStatus.green);
|
||||
await prWorker.checkAutoMerge(pr, config);
|
||||
expect(platform.ensureCommentRemoval).toHaveBeenCalledTimes(0);
|
||||
expect(platform.ensureComment).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
it('should remove previous automerge comment when rebasing', async () => {
|
||||
config.automerge = true;
|
||||
config.automergeType = 'pr-comment';
|
||||
config.automergeComment = '!merge';
|
||||
config.rebaseRequested = true;
|
||||
pr.isModified = false;
|
||||
platform.getBranchStatus.mockResolvedValueOnce(BranchStatus.green);
|
||||
await prWorker.checkAutoMerge(pr, config);
|
||||
expect(platform.ensureCommentRemoval).toHaveBeenCalledTimes(1);
|
||||
expect(platform.ensureComment).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
it('should not automerge if enabled and pr is mergeable but cannot rebase', async () => {
|
||||
|
|
|
@ -437,6 +437,7 @@ export async function checkAutoMerge(
|
|||
automergeType,
|
||||
automergeComment,
|
||||
requiredStatusChecks,
|
||||
rebaseRequested,
|
||||
} = config;
|
||||
logger.debug(
|
||||
{ automerge, automergeType, automergeComment },
|
||||
|
@ -481,6 +482,12 @@ export async function checkAutoMerge(
|
|||
);
|
||||
return false;
|
||||
}
|
||||
if (rebaseRequested) {
|
||||
await platform.ensureCommentRemoval({
|
||||
number: pr.number,
|
||||
content: automergeComment,
|
||||
});
|
||||
}
|
||||
return platform.ensureComment({
|
||||
number: pr.number,
|
||||
topic: null,
|
||||
|
|
Loading…
Reference in a new issue