diff --git a/internal/convention/commit_test.go b/internal/convention/commit_test.go index 3811eab..74a0508 100644 --- a/internal/convention/commit_test.go +++ b/internal/convention/commit_test.go @@ -34,6 +34,12 @@ func TestNewCommit(t *testing.T) { Message: "feat(lang): add polish language", }, }, + { + name: "Commit message with scope", + c: git.Commit{ + Message: "feat(bump00): allow bump minor", + }, + }, { name: "Uppercase", c: git.Commit{ diff --git a/internal/convention/option.go b/internal/convention/option.go index b970495..801214c 100644 --- a/internal/convention/option.go +++ b/internal/convention/option.go @@ -20,7 +20,8 @@ const ( var ( ErrEmptyCommit = errors.New("empty commit") - headerRegex = regexp.MustCompile(`(?P[a-zA-Z]+)(?P\([a-zA-Z]+\))?(?P!)?:\s(?P.+)`) + // Self build + headerRegex = regexp.MustCompile(`(?P[a-zA-Z0-9]+)(?P\([a-zA-Z0-9]+\))?(?P!)?:\s(?P.+)`) ) type OptionFn func(*Commit) error diff --git a/internal/convention/testdata/TestNewCommit/Commit_message_with_scope#01.golden b/internal/convention/testdata/TestNewCommit/Commit_message_with_scope#01.golden new file mode 100644 index 0000000..562da90 --- /dev/null +++ b/internal/convention/testdata/TestNewCommit/Commit_message_with_scope#01.golden @@ -0,0 +1,5 @@ +{ + "RawHeader": "feat(bump00): allow bump minor (0001-01-01)", + "Type": "feat", + "Scope": "bump00" +} \ No newline at end of file