Compare commits

..

No commits in common. "04ee64a79cc04ee1e1e52818567357c4016a20de" and "367622da35b82af43adffa6d2dbc9972faefd931" have entirely different histories.

2 changed files with 2 additions and 9 deletions

View File

@ -192,7 +192,7 @@ func ParseConfFile(path string) (conf *Conf, err error) {
return return
} }
func ParseMsg(confRoot, confName, msg, tag string) (confPath, group string, err error) { func ParseMsg(confRoot, confName, msg string) (confPath, group string, err error) {
slog.Info("parse msg", "msg", msg) slog.Info("parse msg", "msg", msg)
conventionalCommit, err := parseConventionalCommit(msg) conventionalCommit, err := parseConventionalCommit(msg)
if err != nil { if err != nil {
@ -210,11 +210,6 @@ func ParseMsg(confRoot, confName, msg, tag string) (confPath, group string, err
err = fmt.Errorf("invalid scope as path: %s", conventionalCommit.Scope) err = fmt.Errorf("invalid scope as path: %s", conventionalCommit.Scope)
return return
} }
if tag != "" && conventionalCommit.Scope != tag {
err = fmt.Errorf("tag does not match scope: %s != %s", tag,
conventionalCommit.Scope)
return
}
groupKeywords := []string{"joj"} groupKeywords := []string{"joj"}
for _, groupKeyword := range groupKeywords { for _, groupKeyword := range groupKeywords {
if strings.Contains( if strings.Contains(

View File

@ -15,7 +15,6 @@ var (
confRoot string confRoot string
confName string confName string
msg string msg string
tag string
showVersion *bool showVersion *bool
Version string = "debug" Version string = "debug"
) )
@ -24,7 +23,6 @@ func init() {
flag.StringVar(&confRoot, "conf-root", ".", "root path for all config files") flag.StringVar(&confRoot, "conf-root", ".", "root path for all config files")
flag.StringVar(&confName, "conf-name", "conf.json", "filename for config files") flag.StringVar(&confName, "conf-name", "conf.json", "filename for config files")
flag.StringVar(&msg, "msg", "", "message to trigger the running, leave empty to use git commit message on HEAD") flag.StringVar(&msg, "msg", "", "message to trigger the running, leave empty to use git commit message on HEAD")
flag.StringVar(&tag, "tag", "", "tag to trigger the running, when non-empty, should equal to the scope in msg")
showVersion = flag.Bool("version", false, "print current version") showVersion = flag.Bool("version", false, "print current version")
} }
@ -47,7 +45,7 @@ func mainImpl() error {
return err return err
} }
} }
confPath, group, err := conf.ParseMsg(confRoot, confName, msg, tag) confPath, group, err := conf.ParseMsg(confRoot, confName, msg)
if err != nil { if err != nil {
slog.Error("parse msg", "error", err) slog.Error("parse msg", "error", err)
validScopes, scopeErr := conf.ListValidScopes( validScopes, scopeErr := conf.ListValidScopes(