Merge pull request #55122 from ClickHouse/vdimir/status_comment_link

Add links to check reports in status comment
This commit is contained in:
Alexey Milovidov 2023-09-30 08:55:54 +03:00 committed by GitHub
commit be9a3cea42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -240,9 +240,16 @@ def generate_status_comment(pr_info: PRInfo, statuses: CommitStatuses) -> str:
hidden_table_rows = [] # type: List[str] hidden_table_rows = [] # type: List[str]
for desc, gs in grouped_statuses.items(): for desc, gs in grouped_statuses.items():
state = get_worst_state(gs) 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>'
table_row = ( table_row = (
f"<tr><td>{desc.name}</td><td>{desc.description}</td>" 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: if state == SUCCESS:
hidden_table_rows.append(table_row) hidden_table_rows.append(table_row)