From ccfcd1e583f6f2df913c2186cabeb89cefd6718d Mon Sep 17 00:00:00 2001 From: Integer Limit <103940576+IntegerLimit@users.noreply.github.com> Date: Tue, 27 Aug 2024 16:50:17 +1000 Subject: [PATCH] Fix Transformation of Issue/PR Tags in Changelog (#966) [SKIP] --- tools/tasks/changelog/pusher.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/tasks/changelog/pusher.ts b/tools/tasks/changelog/pusher.ts index df351c3..d047c63 100644 --- a/tools/tasks/changelog/pusher.ts +++ b/tools/tasks/changelog/pusher.ts @@ -374,6 +374,7 @@ async function transformAllIssueURLs(changelog: string[]) { */ async function transformTags(message: string): Promise { const promises: Promise[] = []; + const transformed: Set = new Set(); if (message.search(/#\d+/) !== -1) { const matched = message.match(/#\d+/g) ?? []; for (const match of matched) { @@ -382,10 +383,14 @@ async function transformTags(message: string): Promise { if (!digitsMatch) continue; const digits = Number.parseInt(digitsMatch[0]); + if (transformed.has(digits)) continue; + transformed.add(digits); + // Get PR/Issue Info (PRs are listed in the Issue API Endpoint) promises.push( - getIssueURL(digits).then((url) => - message.replace(match, `[#${digits}](${url})`), + getIssueURL(digits).then( + (url) => + (message = message.replaceAll(match, `[#${digits}](${url})`)), ), ); }