Skip to content
21 changes: 19 additions & 2 deletions .github/workflows/mirror-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,26 @@ jobs:
// Match and extract changelog item
const itemMatch = trimmedLine.match(/^[*-]\s(.*)$/);
if (itemMatch) {
const originalContent = itemMatch[1];
let originalContent = itemMatch[1];

// This is a two-step process to prevent `release-please` from
// creating mangled, doubly-nested links for PRs.

// STEP 1: CLEAN THE INPUT.
// The source changelog contains a zero-width space as an HTML entity (`​`).
// This breaks the regex in the next step, so we must remove it first.
// E.g., "[#​1770](...)" becomes "[#1770](...)"
originalContent = originalContent.replace(/​/g, '');

// STEP 2: PROTECT THE OUTPUT.
// `release-please` aggressively tries to auto-link any text that looks like `#1234`.
// To prevent this, we insert an invisible Unicode zero-width space (`\u200B`)
// between the '#' and the number in the link text. This breaks the parser's
// pattern matching without changing the visual appearance of the link.
// E.g., "[#1770](...)" becomes "[genai-toolbox#​1770](...)"
originalContent = originalContent.replace(/\[#(\d+)\](\([^)]+\))/g, '[genai-toolbox#\u200B$1]$2');

const lineAsLowerCase = originalContent.toLowerCase();

const hasPrefix = prefixesToFilter.some(prefix => lineAsLowerCase.includes(prefix));

// Check if the line includes ANY of the required keywords
Expand Down
Loading