From 80934e65f5f0768dbd221f5b88b6017d6c7e2ac7 Mon Sep 17 00:00:00 2001 From: Adam Setch <adam.setch@outlook.com> Date: Fri, 17 Feb 2023 18:27:27 -0500 Subject: [PATCH] fix(platform/bitbucket): update rebase instructions (#20482) --- lib/modules/platform/bitbucket/comments.ts | 11 +++++++++++ lib/modules/platform/bitbucket/index.ts | 2 +- .../repository/update/branch/handle-existing.ts | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/modules/platform/bitbucket/comments.ts b/lib/modules/platform/bitbucket/comments.ts index b725e1ad04..ddb4916cf5 100644 --- a/lib/modules/platform/bitbucket/comments.ts +++ b/lib/modules/platform/bitbucket/comments.ts @@ -95,6 +95,10 @@ export async function ensureComment({ } }); } + + // sanitize any language that isn't supported by Bitbucket Cloud + body = sanitizeCommentBody(body); + if (!commentId) { await addComment(config, prNo, body); logger.info( @@ -146,3 +150,10 @@ export async function ensureCommentRemoval( logger.warn({ err }, 'Error ensuring comment removal'); } } + +function sanitizeCommentBody(body: string): string { + return body.replace( + 'checking the rebase/retry box above', + 'renaming this PR to start with "rebase!"' + ); +} diff --git a/lib/modules/platform/bitbucket/index.ts b/lib/modules/platform/bitbucket/index.ts index 589557487c..2b547488a6 100644 --- a/lib/modules/platform/bitbucket/index.ts +++ b/lib/modules/platform/bitbucket/index.ts @@ -484,7 +484,7 @@ export function massageMarkdown(input: string): string { return smartTruncate(input, 50000) .replace( 'you tick the rebase/retry checkbox', - 'rename PR to start with "rebase!"' + 'by renaming this PR to start with "rebase!"' ) .replace(regEx(/<\/?summary>/g), '**') .replace(regEx(/<\/?details>/g), '') diff --git a/lib/workers/repository/update/branch/handle-existing.ts b/lib/workers/repository/update/branch/handle-existing.ts index b378ededb8..3418079485 100644 --- a/lib/workers/repository/update/branch/handle-existing.ts +++ b/lib/workers/repository/update/branch/handle-existing.ts @@ -62,7 +62,7 @@ export async function handleModifiedPr( const editedPrCommentTopic = 'Edited/Blocked Notification'; const content = - 'Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.\n' + + 'Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.\n\n' + 'You can manually request rebase by checking the rebase/retry box above.\n\n' + emojify(' :warning: **Warning**: custom changes will be lost.'); -- GitLab