Skip to content

Commit ee7e1be

Browse files
ci: Correctly parse mirrored changelog for release-please (#58)
Co-authored-by: Averi Kitsch <[email protected]>
1 parent 2ab008b commit ee7e1be

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

.github/workflows/mirror-changelog.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,26 @@ jobs:
8282
// Match and extract changelog item
8383
const itemMatch = trimmedLine.match(/^[*-]\s(.*)$/);
8484
if (itemMatch) {
85-
const originalContent = itemMatch[1];
85+
let originalContent = itemMatch[1];
86+
87+
// This is a two-step process to prevent `release-please` from
88+
// creating mangled, doubly-nested links for PRs.
89+
90+
// STEP 1: CLEAN THE INPUT.
91+
// The source changelog contains a zero-width space as an HTML entity (`&#8203;`).
92+
// This breaks the regex in the next step, so we must remove it first.
93+
// E.g., "[#&#8203;1770](...)" becomes "[#1770](...)"
94+
originalContent = originalContent.replace(/&#8203;/g, '');
95+
96+
// STEP 2: PROTECT THE OUTPUT.
97+
// `release-please` aggressively tries to auto-link any text that looks like `#1234`.
98+
// To prevent this, we insert an invisible Unicode zero-width space (`\u200B`)
99+
// between the '#' and the number in the link text. This breaks the parser's
100+
// pattern matching without changing the visual appearance of the link.
101+
// E.g., "[#1770](...)" becomes "[genai-toolbox#​1770](...)"
102+
originalContent = originalContent.replace(/\[#(\d+)\](\([^)]+\))/g, '[genai-toolbox#\u200B$1]$2');
103+
86104
const lineAsLowerCase = originalContent.toLowerCase();
87-
88105
const hasPrefix = prefixesToFilter.some(prefix => lineAsLowerCase.includes(prefix));
89106
90107
// Check if the line includes ANY of the required keywords

0 commit comments

Comments
 (0)