@@ -75,8 +75,6 @@ func (container logContainer) printLog(out *strings.Builder, title string, skipp
75
75
func (logs * logsByCategory ) ToMarkdown (skipped bool ) string {
76
76
var markdownString strings.Builder
77
77
78
- markdownString .WriteString ("# Changelog \n " )
79
-
80
78
if ! skipped {
81
79
logs .FEATURE .printLog (& markdownString , "Features" , skipped )
82
80
logs .FIX .printLog (& markdownString , "Fixes" , skipped )
@@ -187,9 +185,10 @@ func CommitLog(path string, startCommitString string, endCommitString string, in
187
185
logContainer .OTHER .include = inclusions .checkInclusion ("other" )
188
186
189
187
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 )
192
190
key = strings .SplitN (strings .TrimSpace (key ), ":" , 2 )[0 ]
191
+ normalizedHash := c .Hash .String () + " - " + normalizeCommit (c .Message , scopedKey )
193
192
194
193
logContainer .AddCommit (key , normalizedHash , skipClassification )
195
194
@@ -214,15 +213,20 @@ func (inclusions *commitTypeInclusions) checkInclusion(flagToCheck string) bool
214
213
return false
215
214
}
216
215
217
- func findKeyInCommit (key string , commitMessage string ) string {
216
+ func findKeyInCommit (key string , commitMessage string ) ( string , string ) {
218
217
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 ]
226
229
}
227
- return ""
230
+
231
+ return scopelessKey , scopedKey
228
232
}
0 commit comments