@@ -75,8 +75,6 @@ func (container logContainer) printLog(out *strings.Builder, title string, skipp
7575func (logs * logsByCategory ) ToMarkdown (skipped bool ) string {
7676 var markdownString strings.Builder
7777
78- markdownString .WriteString ("# Changelog \n " )
79-
8078 if ! skipped {
8179 logs .FEATURE .printLog (& markdownString , "Features" , skipped )
8280 logs .FIX .printLog (& markdownString , "Fixes" , skipped )
@@ -187,9 +185,10 @@ func CommitLog(path string, startCommitString string, endCommitString string, in
187185 logContainer .OTHER .include = inclusions .checkInclusion ("other" )
188186
189187 for _ , c := range commits {
190- normalizedHash := c . Hash . String () + " - " + normalizeCommit ( c .Message )
191- key := findKeyInCommit ( SupportedKeys , c . Message )
188+ key , scopedKey := findKeyInCommit ( SupportedKeys , c .Message )
189+ fmt . Printf ( " key: %v,scopedKey:%v \n " , key , scopedKey )
192190 key = strings .SplitN (strings .TrimSpace (key ), ":" , 2 )[0 ]
191+ normalizedHash := c .Hash .String () + " - " + normalizeCommit (c .Message , scopedKey )
193192
194193 logContainer .AddCommit (key , normalizedHash , skipClassification )
195194
@@ -214,15 +213,20 @@ func (inclusions *commitTypeInclusions) checkInclusion(flagToCheck string) bool
214213 return false
215214}
216215
217- func findKeyInCommit (key string , commitMessage string ) string {
216+ func findKeyInCommit (key string , commitMessage string ) ( string , string ) {
218217 re := regexp .MustCompile (`^(` + key + `)[:]|^((` + key + `)\((\w+[, /\\]*)+\)[:])` )
219- if len (re .FindAllStringSubmatch (commitMessage , - 1 )) > 0 {
220- keyCheckOne := re .FindAllStringSubmatch (commitMessage , - 1 )[0 ][3 ]
221- if keyCheckOne == "" {
222- keyCheckTwo := re .FindAllStringSubmatch (commitMessage , - 1 )[0 ][1 ]
223- return keyCheckTwo
224- }
225- return keyCheckOne
218+ keyMatches := re .FindAllStringSubmatch (commitMessage , - 1 )
219+ fmt .Printf ("%v" , keyMatches )
220+ if len (keyMatches ) == 0 {
221+ return "" , ""
222+ }
223+
224+ scopedKey := keyMatches [0 ][0 ]
225+ scopelessKey := keyMatches [0 ][3 ]
226+
227+ if scopelessKey == "" {
228+ scopelessKey = keyMatches [0 ][1 ]
226229 }
227- return ""
230+
231+ return scopelessKey , scopedKey
228232}
0 commit comments