From 201de7d6bc690c676ddf5c2219819a4ce55ab124 Mon Sep 17 00:00:00 2001 From: BoYanZh Date: Wed, 16 Oct 2024 15:09:28 -0400 Subject: [PATCH] feat: issue with submitter --- joint_teapot/app.py | 3 ++- joint_teapot/utils/joj3.py | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/joint_teapot/app.py b/joint_teapot/app.py index 8dcee9b..db4948b 100644 --- a/joint_teapot/app.py +++ b/joint_teapot/app.py @@ -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) diff --git a/joint_teapot/utils/joj3.py b/joint_teapot/utils/joj3.py index 1576a4a..8431c49 100644 --- a/joint_teapot/utils/joj3.py +++ b/joint_teapot/utils/joj3.py @@ -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" )