Skip to content

Commit

Permalink
feat: joj3-env for post stages
Browse files Browse the repository at this point in the history
  • Loading branch information
BoYanZh committed Jan 29, 2025
1 parent 4f194aa commit a239f1e
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions joint_teapot/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit a239f1e

Please sign in to comment.