feat: more info in joj3 commit msgs

This commit is contained in:
张泊明518370910136 2024-10-04 10:45:58 -04:00
parent 6c047795ea
commit f3f45f8280
GPG Key ID: CA088E6D9284F870

View File

@ -224,6 +224,14 @@ def joj3_scoreboard(
"",
help="name of grading repo to push scoreboard file",
),
submitter_repo_name: str = Argument(
"",
help="repository's name of the submitter",
),
run_number: str = Argument(
"",
help="gitea actions run number",
),
scoreboard_file_name: str = Argument(
"scoreboard.csv", help="name of scoreboard file in the gitea repo"
),
@ -249,9 +257,16 @@ def joj3_scoreboard(
submitter,
os.path.join(repo_path, scoreboard_file_name),
)
tea.pot.git.add_commit_and_push(
repo_name, [scoreboard_file_name], f"joj3: update scoreboard by {submitter}"
actions_link = (
f"https://{settings.gitea_domain_name}{settings.gitea_suffix}/"
+ f"{settings.gitea_org_name}/{submitter_repo_name}/"
+ f"actions/runs/{run_number}"
)
commit_message = (
f"joj3: update scoreboard by {submitter} in {submitter_repo_name}\n\n"
+ f"gitea actions link: {actions_link}"
)
tea.pot.git.add_commit_and_push(repo_name, [scoreboard_file_name], commit_message)
@app.command(
@ -263,6 +278,7 @@ def joj3_failed_table(
score_file_path: str = Argument(
"", help="path to score json file generated by JOJ3"
),
submitter: str = Argument("", help="submitter ID"),
repo_name: str = Argument(
"",
help="name of grading repo to push failed table file",
@ -299,7 +315,7 @@ def joj3_failed_table(
f"https://{settings.gitea_domain_name}{settings.gitea_suffix}/"
+ f"{settings.gitea_org_name}/{submitter_repo_name}"
)
action_link = (
actions_link = (
f"https://{settings.gitea_domain_name}{settings.gitea_suffix}/"
+ f"{settings.gitea_org_name}/{submitter_repo_name}/"
+ f"actions/runs/{run_number}"
@ -309,12 +325,16 @@ def joj3_failed_table(
submitter_repo_name,
submitter_repo_link,
os.path.join(repo_path, failed_table_file_name),
action_link,
actions_link,
)
commit_message = (
f"joj3: update failed table by {submitter} in {submitter_repo_name}\n\n"
+ f"gitea actions link: {actions_link}"
)
tea.pot.git.add_commit_and_push(
repo_name,
[failed_table_file_name],
f"joj3: update failed table by {submitter_repo_name}",
commit_message,
)
@ -341,13 +361,13 @@ def joj3_create_result_issue(
logger.info(f"debug log to file: {settings.log_file_path}")
if joj3.check_skipped(score_file_path, "skip-result-issue"):
return
action_link = (
actions_link = (
f"https://{settings.gitea_domain_name}{settings.gitea_suffix}/"
+ f"{settings.gitea_org_name}/{submitter_repo_name}/"
+ f"actions/runs/{run_number}"
)
title, comment = joj3.generate_title_and_comment(
score_file_path, action_link, run_number
score_file_path, actions_link, run_number
)
tea.pot.gitea.create_issue(submitter_repo_name, title, comment, False)