feat: joj3-env for post stages
This commit is contained in:
parent
4f194aa7bd
commit
a239f1e388
|
@ -639,6 +639,80 @@ def joj3_all(
|
|||
sleep(retry_interval)
|
||||
|
||||
|
||||
@app.command(
|
||||
"joj3-env",
|
||||
help="run all joj3 tasks from env var and cli args",
|
||||
)
|
||||
def joj3_env(
|
||||
env_path: str = Argument("", help="path to .env file"),
|
||||
score_file_path: str = Argument(
|
||||
"", help="path to score json file generated by JOJ3"
|
||||
),
|
||||
repo_name: str = Argument(
|
||||
"",
|
||||
help="name of grading repo to push failed table file",
|
||||
),
|
||||
submitter_repo_name: str = Argument(
|
||||
"",
|
||||
help="repository's name of the submitter",
|
||||
),
|
||||
scoreboard_file_name: str = Argument(
|
||||
"scoreboard.csv", help="name of scoreboard file in the gitea repo"
|
||||
),
|
||||
failed_table_file_name: str = Argument(
|
||||
"failed-table.md", help="name of failed table file in the gitea repo"
|
||||
),
|
||||
max_total_score: int = Option(
|
||||
-1,
|
||||
help="max total score",
|
||||
),
|
||||
skip_result_issue: bool = Option(
|
||||
False,
|
||||
help="skip creating result issue on gitea",
|
||||
),
|
||||
skip_scoreboard: bool = Option(
|
||||
False,
|
||||
help="skip creating scoreboard on gitea",
|
||||
),
|
||||
skip_failed_table: bool = Option(
|
||||
False,
|
||||
help="skip creating failed table on gitea",
|
||||
),
|
||||
submitter_in_issue_title: bool = Option(
|
||||
True,
|
||||
help="whether to include submitter in issue title",
|
||||
),
|
||||
) -> None:
|
||||
submitter = os.getenv("GITHUB_ACTOR")
|
||||
run_number = os.getenv("GITHUB_RUN_NUMBER")
|
||||
exercise_name = os.getenv("CONF_NAME")
|
||||
commit_hash = os.getenv("GITHUB_SHA")
|
||||
run_id = os.getenv("RUN_ID")
|
||||
groups = os.getenv("GROUPS")
|
||||
if None in (submitter, run_number, exercise_name, commit_hash, run_id, groups):
|
||||
logger.error("missing required env var")
|
||||
raise Exit(code=1)
|
||||
joj3_all(
|
||||
env_path,
|
||||
score_file_path,
|
||||
submitter,
|
||||
repo_name,
|
||||
submitter_repo_name,
|
||||
run_number,
|
||||
scoreboard_file_name,
|
||||
failed_table_file_name,
|
||||
exercise_name,
|
||||
commit_hash,
|
||||
run_id,
|
||||
groups,
|
||||
max_total_score,
|
||||
skip_result_issue,
|
||||
skip_scoreboard,
|
||||
skip_failed_table,
|
||||
submitter_in_issue_title,
|
||||
)
|
||||
|
||||
|
||||
@app.command(
|
||||
"joj3-check",
|
||||
help="check joj3 restrictions",
|
||||
|
|
Loading…
Reference in New Issue
Block a user