Skip to content

Commit

Permalink
feat: more info in joj3 commit msgs
Browse files Browse the repository at this point in the history
  • Loading branch information
BoYanZh committed Oct 4, 2024
1 parent 6c04779 commit f3f45f8
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions joint_teapot/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
),
Expand All @@ -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(
Expand All @@ -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",
Expand Down Expand Up @@ -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}"
Expand All @@ -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,
)


Expand All @@ -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)

Expand Down

0 comments on commit f3f45f8

Please sign in to comment.