diff --git a/cmd/joj3/env/env.go b/cmd/joj3/env/env.go index 2b88321..0dd57ed 100644 --- a/cmd/joj3/env/env.go +++ b/cmd/joj3/env/env.go @@ -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) +} diff --git a/cmd/joj3/main.go b/cmd/joj3/main.go index 1398f6f..e0e8e86 100644 --- a/cmd/joj3/main.go +++ b/cmd/joj3/main.go @@ -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 diff --git a/cmd/joj3/teapot/run.go b/cmd/joj3/teapot/run.go index 924ac92..2b507b8 100644 --- a/cmd/joj3/teapot/run.go +++ b/cmd/joj3/teapot/run.go @@ -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,