File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 7272 // Match and extract changelog item
7373 const itemMatch = trimmedLine.match(/^[*-]\s(.*)$/);
7474 if (itemMatch) {
75- const originalContent = itemMatch[1];
75+ let originalContent = itemMatch[1];
76+
77+ // This is a two-step process to prevent `release-please` from
78+ // creating mangled, doubly-nested links for PRs.
79+
80+ // STEP 1: CLEAN THE INPUT.
81+ // The source changelog contains a zero-width space as an HTML entity (`​`).
82+ // This breaks the regex in the next step, so we must remove it first.
83+ // E.g., "[#​1770](...)" becomes "[#1770](...)"
84+ originalContent = originalContent.replace(/​/g, '');
85+
86+ // STEP 2: PROTECT THE OUTPUT.
87+ // `release-please` aggressively tries to auto-link any text that looks like `#1234`.
88+ // To prevent this, we insert an invisible Unicode zero-width space (`\u200B`)
89+ // between the '#' and the number in the link text. This breaks the parser's
90+ // pattern matching without changing the visual appearance of the link.
91+ // E.g., "[#1770](...)" becomes "[genai-toolbox#1770](...)"
92+ originalContent = originalContent.replace(/\[#(\d+)\](\([^)]+\))/g, '[genai-toolbox#\u200B$1]$2');
93+
7694 newChangelog.push(`${currentType}: ${originalContent}`);
7795 }
7896 }
You can’t perform that action at this time.
0 commit comments