fix: use default conf if anything fail
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
zzjc1234 2024-09-19 11:04:50 +08:00
parent e8506eeb51
commit a186c63d76

View File

@ -121,23 +121,27 @@ func commitMsgToConf() (conf Conf, err error) {
switch head {
case "feat", "fix", "refactor", "perf", "test", "build", "revert":
if len(words) < 2 {
return Conf{}, fmt.Errorf("error: hw not assigned")
// TODO: Decide strategy to give students error
// if len(words) < 2 {
// return Conf{}, fmt.Errorf("error: hw not assigned")
// }
if len(words) >= 2 {
hw = words[1]
if err = validateHw(hw); err == nil {
file = strings.Replace(file, "conf", "conf-"+hw+"-cq", 1)
}
}
hw = words[1]
if err = validateHw(hw); err != nil {
return
}
file = strings.Replace(file, "conf", "conf-"+hw+"-cq", 1)
case "joj", "grading":
if len(words) < 2 {
return Conf{}, fmt.Errorf("error: hw not assigned")
// TODO: Decide strategy to give students error
// if len(words) < 2 {
// return Conf{}, fmt.Errorf("error: hw not assigned")
// }
if len(words) >= 2 {
hw = words[1]
if err = validateHw(hw); err == nil {
file = strings.Replace(file, "conf", "conf-"+hw+"-oj", 1)
}
}
hw = words[1]
if err = validateHw(hw); err != nil {
return
}
file = strings.Replace(file, "conf", "conf-"+hw+"-oj", 1)
}
conf, err = parseConfFile(file)