Skip to content

Commit 0b184a5

Browse files
committed
Treat ready-for-review as author activity
1 parent 87ec001 commit 0b184a5

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

.github/scripts/pull-request-dashboard.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ def fetch_pr_raw(
384384
pr_summary: dict[str, Any],
385385
) -> dict[str, Any]:
386386
number = pr_summary["number"]
387-
with ThreadPoolExecutor(max_workers=7) as pool:
387+
with ThreadPoolExecutor(max_workers=8) as pool:
388388
f_pr = pool.submit(gh_pr_view, repo, number)
389389
f_issue = pool.submit(
390390
gh_api,
@@ -406,6 +406,11 @@ def fetch_pr_raw(
406406
f"/repos/{owner}/{repo_name}/pulls/{number}/commits?per_page=100",
407407
True,
408408
)
409+
f_timeline = pool.submit(
410+
gh_api,
411+
f"/repos/{owner}/{repo_name}/issues/{number}/timeline?per_page=100",
412+
True,
413+
)
409414
f_checks = pool.submit(gh_pr_checks, repo, number)
410415
f_threads = pool.submit(fetch_review_threads, owner, repo_name, number)
411416
return {
@@ -415,6 +420,7 @@ def fetch_pr_raw(
415420
"review_comments": f_revcom.result() or [],
416421
"reviews": f_reviews.result() or [],
417422
"commits": f_commits.result() or [],
423+
"timeline": f_timeline.result() or [],
418424
"checks": f_checks.result() or [],
419425
"review_threads": f_threads.result() or [],
420426
}
@@ -494,6 +500,21 @@ def normalize_events(raw: dict[str, Any], author: str, reviewers: set[str]) -> l
494500
"sha": None,
495501
"is_merge_from_base_by_non_author": False,
496502
})
503+
for t in raw["timeline"]:
504+
if t.get("event") != "ready_for_review":
505+
continue
506+
login = actor_login(t.get("actor") or {})
507+
events.append({
508+
"kind": "ready-for-review",
509+
"timestamp": t.get("created_at") or "",
510+
"actor": login,
511+
"actor_role": "author",
512+
"body": "",
513+
"state": None,
514+
"path": None,
515+
"sha": None,
516+
"is_merge_from_base_by_non_author": False,
517+
})
497518
events = [e for e in events if e["timestamp"]]
498519
events.sort(key=lambda e: e["timestamp"])
499520
return events
@@ -504,6 +525,8 @@ def is_substantive_activity(event: dict[str, Any]) -> bool:
504525
return False
505526
if event.get("actor_role") == "bot":
506527
return False
528+
if event["kind"] == "ready-for-review":
529+
return True
507530
if event["kind"] == "review-state" and event.get("state") != "COMMENTED":
508531
return True
509532
return bool((event.get("body") or "").strip())

0 commit comments

Comments
 (0)