feat: update joj3 issue format
This commit is contained in:
parent
b128625bce
commit
cc9cb3224c
|
@ -325,7 +325,9 @@ def joj3_create_result_issue(
|
||||||
+ f"{settings.gitea_org_name}/{submitter_repo_name}/"
|
+ f"{settings.gitea_org_name}/{submitter_repo_name}/"
|
||||||
+ f"actions/runs/{run_number}"
|
+ f"actions/runs/{run_number}"
|
||||||
)
|
)
|
||||||
title, comment = joj3.generate_title_and_comment(score_file_path, action_link)
|
title, comment = joj3.generate_title_and_comment(
|
||||||
|
score_file_path, action_link, run_number
|
||||||
|
)
|
||||||
tea.pot.gitea.create_issue(submitter_repo_name, title, comment, False)
|
tea.pot.gitea.create_issue(submitter_repo_name, title, comment, False)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -166,23 +166,22 @@ def generate_failed_table(
|
||||||
|
|
||||||
|
|
||||||
def generate_title_and_comment(
|
def generate_title_and_comment(
|
||||||
score_file_path: str, action_link: str
|
score_file_path: str, action_link: str, run_number: str
|
||||||
) -> Tuple[str, str]:
|
) -> Tuple[str, str]:
|
||||||
with open(score_file_path) as json_file:
|
with open(score_file_path) as json_file:
|
||||||
stages: List[Dict[str, Any]] = json.load(json_file)
|
stages: List[Dict[str, Any]] = json.load(json_file)
|
||||||
|
|
||||||
total_score = 0
|
total_score = 0
|
||||||
comment = f"Generated by [Gitea Actions]({action_link})\n"
|
comment = f"Generated by [Gitea Actions #{run_number}]({action_link})\n"
|
||||||
for stage in stages:
|
for stage in stages:
|
||||||
comment += f"## {stage['name']}\n"
|
comment += f"## {stage['name']}"
|
||||||
single_case = len(stage["results"]) == 1
|
single_case = len(stage["results"]) == 1
|
||||||
|
if single_case:
|
||||||
|
comment += f" - Score: {stage['results'][0]['score']}"
|
||||||
|
comment += "\n"
|
||||||
for i, result in enumerate(stage["results"]):
|
for i, result in enumerate(stage["results"]):
|
||||||
comment += "### "
|
|
||||||
if not single_case:
|
if not single_case:
|
||||||
comment += f"Case {i} - Score: {result['score']}"
|
comment += f"### Case {i} - Score: {result['score']}\n"
|
||||||
else:
|
|
||||||
comment += f"Score: {result['score']}"
|
|
||||||
comment += "\n"
|
|
||||||
if result["comment"].strip() != "":
|
if result["comment"].strip() != "":
|
||||||
comment += f"{result['comment']}\n"
|
comment += f"{result['comment']}\n"
|
||||||
total_score += result["score"]
|
total_score += result["score"]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user