From b7f5f14c53385d076385eaf23b6d47048d7b99f9 Mon Sep 17 00:00:00 2001 From: Alex Szabo Date: Tue, 14 Jan 2025 18:09:15 +0100 Subject: [PATCH] fix links by adding a line-break after the comment --- .buildkite/pipeline-utils/github/github.ts | 2 +- .buildkite/scripts/lifecycle/comment_on_pr.ts | 21 +++++++------------ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/.buildkite/pipeline-utils/github/github.ts b/.buildkite/pipeline-utils/github/github.ts index 387fdd5964bff..a201457b09ede 100644 --- a/.buildkite/pipeline-utils/github/github.ts +++ b/.buildkite/pipeline-utils/github/github.ts @@ -136,7 +136,7 @@ export async function upsertComment( } const commentMarker = ``; - const body = `${commentMarker}${commentBody}`; + const body = `${commentMarker}\n${commentBody}`; const existingComment = ( await github.paginate(github.issues.listComments, { diff --git a/.buildkite/scripts/lifecycle/comment_on_pr.ts b/.buildkite/scripts/lifecycle/comment_on_pr.ts index 83aa524077e93..f44f6330c121c 100644 --- a/.buildkite/scripts/lifecycle/comment_on_pr.ts +++ b/.buildkite/scripts/lifecycle/comment_on_pr.ts @@ -42,15 +42,13 @@ export function commentOnPR({ context?: string; clearPrevious: boolean; }) { - const message = linkify( - messageTemplate.replace(/\${([^}]+)}/g, (_, envVar) => { - if (ALLOWED_ENV_VARS.includes(envVar)) { - return process.env[envVar] || ''; - } else { - return '${' + envVar + '}'; - } - }) - ); + const message = messageTemplate.replace(/\${([^}]+)}/g, (_, envVar) => { + if (ALLOWED_ENV_VARS.includes(envVar)) { + return process.env[envVar] || ''; + } else { + return '${' + envVar + '}'; + } + }); if (context) { return upsertComment({ commentBody: message, commentContext: context, clearPrevious }); @@ -59,11 +57,6 @@ export function commentOnPR({ } } -function linkify(text: string) { - const linkRegex = /https?:\/\/\S+/g; - return text.replaceAll(linkRegex, '[$&]($&)'); -} - if (require.main === module) { const args = parseArgs<{ context?: string;