feat: issue with submitter

This commit is contained in:
张泊明518370910136 2024-10-16 15:09:28 -04:00
parent 2ac1ab4ead
commit 201de7d6bc
2 changed files with 9 additions and 3 deletions

View File

@ -368,6 +368,7 @@ def joj3_create_result_issue(
"unknown",
help="name of the exercise that appears on the issue title",
),
submitter: str = Argument("", help="submitter ID"),
) -> None:
set_settings(Settings(_env_file=env_path))
set_logger(settings.stderr_log_level, diagnose=False, backtrace=False)
@ -380,7 +381,7 @@ def joj3_create_result_issue(
+ f"actions/runs/{run_number}"
)
title, comment = joj3.generate_title_and_comment(
score_file_path, actions_link, run_number, exercise_name
score_file_path, actions_link, run_number, exercise_name, submitter
)
tea.pot.gitea.create_issue(submitter_repo_name, title, comment, False)

View File

@ -179,7 +179,11 @@ def generate_failed_table(
def generate_title_and_comment(
score_file_path: str, action_link: str, run_number: str, exercise_name: str
score_file_path: str,
action_link: str,
run_number: str,
exercise_name: str,
submitter: str,
) -> Tuple[str, str]:
with open(score_file_path) as json_file:
stages: List[Dict[str, Any]] = json.load(json_file)
@ -191,7 +195,8 @@ def generate_title_and_comment(
exercise_name = comment.split("-")[0]
total_score = 0
comment = (
f"Generated from [Gitea Actions #{run_number}]({action_link}). "
f"Generated from [Gitea Actions #{run_number}]({action_link}), "
+ f"triggered by @{submitter}.\n"
+ "Powered by [JOJ3](https://github.com/joint-online-judge/JOJ3) and "
+ "[Joint-Teapot](https://github.com/BoYanZh/Joint-Teapot) with ❤️.\n"
)