fix(cmd/joj3): return empty conventional commit on parsing error
Some checks failed
build / build (push) Failing after 2m28s
build / trigger-build-image (push) Has been skipped
submodules sync / sync (push) Failing after 29s

This commit is contained in:
张泊明518370910136 2025-06-02 23:08:13 -04:00
parent f17c742719
commit b147cf00a9
GPG Key ID: D47306D7062CDA9D

View File

@ -40,7 +40,7 @@ func parseConventionalCommit(commit string) (*ConventionalCommit, error) {
re := regexp.MustCompile(`(?s)^(\w+)(\(([^)]+)\))?!?: (.+?(\[([^\]]+)\])?)(\n\n(.+?))?(\n\n(.+))?$`) re := regexp.MustCompile(`(?s)^(\w+)(\(([^)]+)\))?!?: (.+?(\[([^\]]+)\])?)(\n\n(.+?))?(\n\n(.+))?$`)
matches := re.FindStringSubmatch(strings.TrimSpace(commit)) matches := re.FindStringSubmatch(strings.TrimSpace(commit))
if matches == nil { if matches == nil {
return nil, fmt.Errorf("invalid conventional commit format") return &ConventionalCommit{}, fmt.Errorf("invalid conventional commit format")
} }
cc := &ConventionalCommit{ cc := &ConventionalCommit{
Type: matches[1], Type: matches[1],