Skip to content

Commit

Permalink
fix links by adding a line-break after the comment
Browse files Browse the repository at this point in the history
  • Loading branch information
delanni committed Jan 14, 2025
1 parent ae3f2c5 commit b7f5f14
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipeline-utils/github/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export async function upsertComment(
}

const commentMarker = `<!-- ${KIBANA_COMMENT_SIGIL}:${commentContext} -->`;
const body = `${commentMarker}${commentBody}`;
const body = `${commentMarker}\n${commentBody}`;

const existingComment = (
await github.paginate(github.issues.listComments, {
Expand Down
21 changes: 7 additions & 14 deletions .buildkite/scripts/lifecycle/comment_on_pr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand All @@ -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;
Expand Down

0 comments on commit b7f5f14

Please sign in to comment.