Skip to content

Commit 3563138

Browse files
committed
fix: normalizeTitleForNotes
1 parent 267dda9 commit 3563138

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

.github/scripts/release-notes.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,18 @@ function classifyTitle(title) {
7777
// --- Normalize title for display (keep all prefixes in brackets as-is) ---
7878
function normalizeTitleForNotes(title) {
7979
let t = title.trim();
80-
const match = t.match(/^[\s\p{Emoji_Presentation}\p{Extended_Pictographic}]*\s*(bug|feat|enhancement|refactor|docs|test|chore|task|composite|ux\/ui|proposal|idea|discussion)[:\s-]+/i);
80+
81+
// Match leading emoji + optional :emoji: + optional text prefix like chore:, feat:, etc.
82+
const match = t.match(/^([\s\p{Emoji_Presentation}\p{Extended_Pictographic}]+|(:[a-zA-Z0-9_+-]+:)+)\s*(bug|feat|enhancement|refactor|docs|test|chore|task|composite|ux\/ui)[:\s-]+/i);
8183
if (match) {
82-
const prefix = match[1];
83-
t = t.replace(match[0], `[${prefix.charAt(0).toUpperCase() + prefix.slice(1).toLowerCase()}] `);
84+
const prefix = match[3].toLowerCase();
85+
const sectionName = PREFIX_MAP[prefix];
86+
if (sectionName) {
87+
// Replace everything matched with [Prefix] (first letter capitalized)
88+
t = t.replace(match[0], `[${prefix.charAt(0).toUpperCase() + prefix.slice(1)}] `);
89+
}
8490
}
91+
8592
return t;
8693
}
8794

0 commit comments

Comments
 (0)