Fix link to failed check report in status commit

This commit is contained in:
vdimir 2023-11-02 08:44:03 +00:00
parent f1c7665feb
commit 9021667f82
No known key found for this signature in database
GPG Key ID: 6EE4CE2BEDC51862

View File

@ -242,12 +242,12 @@ def generate_status_comment(pr_info: PRInfo, statuses: CommitStatuses) -> 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'<a href="{target_url}">{state_text}</a>'
# take the first target_url with the worst state
for status in gs:
if status.target_url and status.state == state:
state_text = f'<a href="{status.target_url}">{state_text}</a>'
break
table_row = (
f"<tr><td>{desc.name}</td><td>{desc.description}</td>"
f"<td>{state_text}</td></tr>\n"