File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ import { setChangelog } from './utils';
55import { getGeneriConfig } from './generi' ;
66import conventional from './defines/conventional-commits.json' ;
77
8+ const getValidConventionalCommit = ( str : string ) => {
9+ return conventional . type . some ( ( c ) => str . startsWith ( c ) ) ;
10+ } ;
11+
812const getEmoji = ( str : string ) : string => {
913 const emojis : GeneriEmoticon [ ] = [
1014 [ 'feat' , '🎉 ' ] ,
@@ -38,13 +42,14 @@ const setSubHeader = (commit: Commit) => {
3842
3943const setBasic = ( commit : Commit ) => {
4044 const generi = getGeneriConfig ( ) ;
41- let result : any ;
45+ let result : string [ ] | string ;
4246
4347 if ( generi . commits === 'conventional-commits' ) {
4448 result = commit . summary
4549 . split ( / : ( .+ ) / )
4650 . filter ( ( part ) => part )
47- . map ( ( part ) => part . trimStart ( ) ) ;
51+ . map ( ( part ) => part . trimStart ( ) )
52+ . filter ( ( part ) => getValidConventionalCommit ( part ) ) ;
4853 } else {
4954 result = commit . summary ;
5055 }
@@ -70,7 +75,7 @@ const setBasic = (commit: Commit) => {
7075
7176 if ( isTagCommit ( commit ) ) return '' ;
7277
73- return '* ' + result . trim ( ) + ` [${ commit . sha } ]` + '\n' ;
78+ return '* ' + ( result as string ) . trim ( ) + ` [${ commit . sha } ]` + '\n' ;
7479} ;
7580
7681const isConventionalCommit = ( commit : Commit ) => {
You can’t perform that action at this time.
0 commit comments