Skip to content

Commit e16fe97

Browse files
authored
ci: Correctly parse mirrored changelog for release-please (#52)
1 parent 3e0bfc1 commit e16fe97

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

.github/workflows/mirror-changelog.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,25 @@ jobs:
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
}

0 commit comments

Comments
 (0)