@@ -44,13 +44,29 @@ def generated_prs(repo: RepoSpec, *, env: dict[str, str]) -> list[dict[str, Any]
4444 "--limit" ,
4545 "100" ,
4646 "--json" ,
47- "author,baseRefName,headRefName,isCrossRepository,isDraft,number,title,updatedAt,url" ,
47+ "author,baseRefName,headRefName,isCrossRepository,isDraft,number,statusCheckRollup, title,updatedAt,url" ,
4848 ],
4949 env = env ,
5050 )
5151 return json .loads (result .stdout )
5252
5353
54+ def ci_status (pr : dict [str , Any ]) -> str :
55+ """Return a display-only CI state; never use it to mutate consumer PRs."""
56+
57+ checks = pr .get ("statusCheckRollup" )
58+ if not isinstance (checks , list ) or not checks :
59+ return "MISSING"
60+ if any (not isinstance (check , dict ) or check .get ("status" ) != "COMPLETED" for check in checks ):
61+ return "PENDING"
62+ conclusions = {str (check .get ("conclusion" ) or "" ).upper () for check in checks }
63+ if conclusions == {"SUCCESS" }:
64+ return "GREEN"
65+ if conclusions & {"FAILURE" , "TIMED_OUT" , "CANCELLED" , "ACTION_REQUIRED" , "STARTUP_FAILURE" }:
66+ return "FAILED"
67+ return "NON_GREEN"
68+
69+
5470def classify_generated_prs (
5571 prs : Iterable [dict [str , Any ]],
5672 * ,
@@ -71,7 +87,9 @@ def classify_generated_prs(
7187
7288
7389def render_row (repo : RepoSpec , current : list [dict [str , Any ]], stale : list [dict [str , Any ]]) -> str :
74- current_refs = ", " .join (f"[#{ item ['number' ]} ]({ item ['url' ]} )" for item in current ) or "—"
90+ current_refs = ", " .join (
91+ f"[#{ item ['number' ]} ]({ item ['url' ]} ) · { ci_status (item )} " for item in current
92+ ) or "—"
7593 stale_refs = ", " .join (f"[#{ item ['number' ]} ]({ item ['url' ]} )" for item in stale ) or "—"
7694 return f"| { repo .name } | { current_refs } | { stale_refs } |"
7795
@@ -93,7 +111,7 @@ def main() -> int:
93111 print ()
94112 print ("Consumer repositories are report-only: they are never auto-merged or auto-closed." )
95113 print ()
96- print ("| Repository | Current generated PR | Recognizable stale generated PRs |" )
114+ print ("| Repository | Current generated PR (CI) | Recognizable stale generated PRs |" )
97115 print ("| --- | --- | --- |" )
98116 for repo in CONSUMER_REPOS :
99117 current , stale = classify_generated_prs (
0 commit comments