feat: joj3 comment show link to actions

This commit is contained in:
张泊明518370910136 2024-09-14 21:58:53 -04:00
parent 0b50495d09
commit e332c64221
GPG Key ID: CA088E6D9284F870
2 changed files with 14 additions and 3 deletions

View File

@ -308,9 +308,18 @@ def joj3_create_result_issue(
"",
help="repository's name of the submitter",
),
run_number: str = Argument(
"",
help="gitea actions run number",
),
) -> None:
set_settings(Settings(_env_file=env_path))
title, comment = joj3.generate_title_and_comment(scorefile_path)
action_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(scorefile_path, action_link)
tea.pot.gitea.create_issue(submitter_repo_name, title, comment, False)

View File

@ -164,12 +164,14 @@ def generate_failed_table(
write_failed_table_into_file(data, table_file_path)
def generate_title_and_comment(score_file_path: str) -> Tuple[str, str]:
def generate_title_and_comment(
score_file_path: str, action_link: str
) -> Tuple[str, str]:
with open(score_file_path) as json_file:
stages: List[Dict[str, Any]] = json.load(json_file)
total_score = 0
comment = ""
comment = f"[Gitea Actions]({action_link})\n"
for stage in stages:
comment += f"## {stage['name']}\n"
for i, result in enumerate(stage["results"]):