@@ -82,16 +82,28 @@ function normalizeTitleForNotes(title) {
8282 // Remove leading emoji or :emoji: (one or more)
8383 t = t . replace ( / ^ ( [ \s \p{ Emoji_Presentation} \p{ Extended_Pictographic} ] + | ( : [ a - z A - Z 0 - 9 _ + - ] + : ) + ) \s * / u, '' ) ;
8484
85- // Match leading word prefix like chore:, feat:, etc.
86- const match = t . match ( / ^ ( b u g | f e a t | e n h a n c e m e n t | r e f a c t o r | d o c s | t e s t | c h o r e | t a s k | c o m p o s i t e | u x \/ u i ) [: \s - ] + / i ) ;
85+ // Match bracket prefix like [Feat, Enhancement]
86+ const match = t . match ( / ^ \[ ( [ ^ \] ] + ) \] / ) ;
8787 if ( match ) {
88- const prefix = match [ 1 ] . toLowerCase ( ) ;
89- t = t . replace ( match [ 0 ] , `[${ prefix . charAt ( 0 ) . toUpperCase ( ) + prefix . slice ( 1 ) } ] ` ) ;
88+ // Take only the first prefix
89+ const firstPrefix = match [ 1 ] . split ( ',' ) [ 0 ] . trim ( ) ;
90+ // Keep the rest of the title unchanged
91+ t = `[${ firstPrefix } ]` + t . slice ( match [ 0 ] . length ) ;
92+ return t ;
93+ }
94+
95+ // Match single-word prefix like chore:, feat:, etc.
96+ const match2 = t . match ( / ^ ( b u g | f e a t | e n h a n c e m e n t | r e f a c t o r | d o c s | t e s t | c h o r e | t a s k | c o m p o s i t e | u x \/ u i ) [: \s - ] + / i) ;
97+ if ( match2 ) {
98+ const prefix = match2 [ 1 ] . toLowerCase ( ) ;
99+ t = t . replace ( match2 [ 0 ] , `[${ prefix . charAt ( 0 ) . toUpperCase ( ) + prefix . slice ( 1 ) } ] ` ) ;
90100 }
91101
92102 return t ;
93103}
94104
105+
106+
95107// --- Fetch all closed PRs ---
96108async function getAllPRs ( { owner, repo, base } ) {
97109 const perPage = 100 ;
0 commit comments