Skip to content

Commit 9beedd7

Browse files
committed
feat: show passed checks in a collapsible section on success
The success report now includes a '<details>' block listing every check that passed per scope, so users can confirm which rules were actually evaluated without leaving the summary or PR comment.
1 parent 616eb74 commit 9beedd7

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

‎main.py‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,21 @@ def _markdown_details(results: list[ScopeResult]) -> str:
415415
return "\n".join(sections)
416416

417417

418+
def _markdown_passed_details(results: list[ScopeResult]) -> str:
419+
"""Render the collapsible section listing which checks passed per scope."""
420+
rows = ["| Scope | Passed checks |", "|---|---|"]
421+
for scope in results:
422+
passed = [c for c in scope.checks if c["status"] == "pass"]
423+
if passed:
424+
links = ", ".join(_rule_markdown_link(c) for c in passed)
425+
else:
426+
links = "\u2014"
427+
rows.append(f"| {scope.label} | {links} |")
428+
return "\n".join(
429+
["<details>", "<summary>Show details</summary>", "", *rows, "", "</details>"]
430+
)
431+
432+
418433
def render_report(results: list[ScopeResult], include_footer: bool = True) -> str:
419434
"""Render the Markdown report shared by the job summary and PR comment.
420435
@@ -425,7 +440,14 @@ def render_report(results: list[ScopeResult], include_footer: bool = True) -> st
425440
"""
426441
if all(scope.status == "pass" for scope in results):
427442
scopes = "scope" if len(results) == 1 else "scopes"
428-
return f"{REPORT_TITLE}\n\n✅ All checks passed ({len(results)} {scopes})"
443+
lines = [
444+
REPORT_TITLE,
445+
"",
446+
f"✅ All checks passed ({len(results)} {scopes})",
447+
"",
448+
_markdown_passed_details(results),
449+
]
450+
return "\n".join(lines)
429451

430452
failures = _failure_count(results)
431453
unit = "failure" if failures == 1 else "failures"

‎main_test.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,10 @@ def test_all_pass(self):
633633
body = main.render_job_summary([pass_scope("Branch")])
634634
self.assertTrue(body.startswith(main.REPORT_TITLE))
635635
self.assertIn("All checks passed (1 scope)", body)
636+
self.assertIn("<details>", body)
637+
self.assertIn("<summary>Show details</summary>", body)
638+
self.assertIn("| Scope | Passed checks |", body)
639+
self.assertIn("| Branch | CC001 branch |", body)
636640

637641
def test_failure_renders_table_with_rule_links(self):
638642
body = main.render_job_summary([fail_scope("Commit 1/1")])

0 commit comments

Comments
 (0)