Add links to check reports in status comment

This commit is contained in:
vdimir 2023-09-29 08:46:23 +00:00
parent 1d436e6fa5
commit 37bd5dd7be
No known key found for this signature in database
GPG Key ID: 6EE4CE2BEDC51862

View File

@ -240,9 +240,16 @@ def generate_status_comment(pr_info: PRInfo, statuses: CommitStatuses) -> str:
hidden_table_rows = [] # type: List[str]
for desc, gs in grouped_statuses.items():
state = get_worst_state(gs)
state_text = f"{STATUS_ICON_MAP[state]} {state}"
# take the first target_url
target_url = next(
(status.target_url for status in gs if status.target_url), None
)
if target_url:
state_text = f"[{state_text}]({target_url})"
table_row = (
f"<tr><td>{desc.name}</td><td>{desc.description}</td>"
f"<td>{STATUS_ICON_MAP[state]} {state}</td></tr>\n"
f"<td>{state_text}</td></tr>\n"
)
if state == SUCCESS:
hidden_table_rows.append(table_row)