Skip to content

Commit

Permalink
feat: supports commit messages that do not follow conventional commit…
Browse files Browse the repository at this point in the history
… format.
  • Loading branch information
outofcoffee committed Sep 3, 2023
1 parent 8344b2f commit 943c537
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions convcommits/commits.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,18 @@ func CategoriseByType(commits []string) map[string][]string {
categorised := make(map[string][]string)
for _, commit := range commits {
parts := strings.Split(commit, ":")
if len(parts) < 2 {
continue
}
prefix := strings.TrimSpace(parts[0])
if strings.HasSuffix(prefix, "!") {
prefix = "BREAKING CHANGE"
}
if strings.Contains(prefix, "(") {
prefix = strings.Split(prefix, "(")[0]

var prefix string
if len(parts) >= 2 {
prefix = strings.TrimSpace(parts[0])
if strings.HasSuffix(prefix, "!") {
prefix = "BREAKING CHANGE"
}
if strings.Contains(prefix, "(") {
prefix = strings.Split(prefix, "(")[0]
}
} else {
prefix = ""
}

category := categorised[prefix]
Expand Down

0 comments on commit 943c537

Please sign in to comment.