chore(cmd/joj3): store groups to env
Some checks failed
build / build (push) Failing after 0s
submodules sync / sync (push) Failing after 0s
build / trigger-build-image (push) Has been skipped

This commit is contained in:
张泊明518370910136 2025-01-29 08:27:09 -05:00
parent 454df2c6fc
commit b61e2e8464
GPG Key ID: D47306D7062CDA9D
3 changed files with 13 additions and 3 deletions

7
cmd/joj3/env/env.go vendored
View File

@ -8,6 +8,7 @@ import (
type Attribute struct {
ConfName string
Groups string
RunID string
Actor string
Repository string
@ -39,3 +40,9 @@ func init() {
Attr.Workflow = os.Getenv("GITHUB_WORKFLOW")
Attr.RunNumber = os.Getenv("GITHUB_RUN_NUMBER")
}
func Set() {
os.Setenv("CONF_NAME", Attr.ConfName)
os.Setenv("GROUPS", Attr.Groups)
os.Setenv("RUN_ID", Attr.RunID)
}

View File

@ -5,6 +5,7 @@ import (
"fmt"
"log/slog"
"os"
"strings"
"github.com/joint-online-judge/JOJ3/cmd/joj3/env"
"github.com/joint-online-judge/JOJ3/cmd/joj3/stage"
@ -116,6 +117,8 @@ func mainImpl() (err error) {
// run stages
groups := conf.MatchGroups(confObj, conventionalCommit)
env.Attr.Groups = strings.Join(groups, ",")
env.Set()
stageResults, forceQuitStageName, err = stage.Run(
confObj, groups,
)
@ -128,7 +131,7 @@ func mainImpl() (err error) {
}
// run teapot
teapotRunResult, err = teapot.Run(confObj, groups)
teapotRunResult, err = teapot.Run(confObj)
if err != nil {
slog.Error("teapot run", "error", err)
return err

View File

@ -18,7 +18,7 @@ type RunResult struct {
Sha string `json:"sha"`
}
func Run(conf *conf.Conf, groups []string) (
func Run(conf *conf.Conf) (
runResult RunResult, err error,
) {
os.Setenv("LOG_FILE_PATH", conf.Teapot.LogPath)
@ -55,7 +55,7 @@ func Run(conf *conf.Conf, groups []string) (
env.Attr.RunNumber, conf.Teapot.ScoreboardPath,
conf.Teapot.FailedTablePath,
conf.Name, env.Attr.Sha, env.Attr.RunID,
strings.Join(groups, ","),
env.Attr.Groups,
"--max-total-score", strconv.Itoa(conf.MaxTotalScore),
skipIssueArg, skipScoreboardArg,
skipFailedTableArg, submitterInIssueTitleArg,