Skip to content

Commit

Permalink
fix(gitlab): truncate comment (#33348)
Browse files Browse the repository at this point in the history
  • Loading branch information
RahulGautamSingh authored Jan 8, 2025
1 parent 5282f7c commit db31a16
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/modules/platform/gitlab/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1361,9 +1361,12 @@ export async function ensureComment({
if (topic) {
logger.debug(`Ensuring comment "${massagedTopic!}" in #${number}`);
body = `### ${topic}\n\n${sanitizedContent}`;
body = body
.replace(regEx(/Pull Request/g), 'Merge Request')
.replace(regEx(/PR/g), 'MR');
body = smartTruncate(
body
.replace(regEx(/Pull Request/g), 'Merge Request')
.replace(regEx(/PR/g), 'MR'),
maxBodyLength(),
);
comments.forEach((comment: { body: string; id: number }) => {
if (comment.body.startsWith(`### ${massagedTopic!}\n\n`)) {
commentId = comment.id;
Expand All @@ -1372,7 +1375,7 @@ export async function ensureComment({
});
} else {
logger.debug(`Ensuring content-only comment in #${number}`);
body = `${sanitizedContent}`;
body = smartTruncate(`${sanitizedContent}`, maxBodyLength());
comments.forEach((comment: { body: string; id: number }) => {
if (comment.body === body) {
commentId = comment.id;
Expand Down

0 comments on commit db31a16

Please sign in to comment.