chore(cmd/joj3): store groups to env
This commit is contained in:
parent
454df2c6fc
commit
b61e2e8464
7
cmd/joj3/env/env.go
vendored
7
cmd/joj3/env/env.go
vendored
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue
Block a user