Skip to content

Commit fc99166

Browse files
committed
Don't treat merge-from-base commits as substantive activity
Pulling main into a PR branch (e.g. trask clicking 'Update branch' on open-telemetry#18090) was being recorded as the latest substantive event, masking earlier unanswered approver questions. Filter such commits out of the substantive timeline so the author still owes a response.
1 parent d9141bd commit fc99166

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,11 +412,29 @@ def fetch_pr_context(
412412
events = [e for e in events if e["ts"]]
413413
events.sort(key=lambda e: e["ts"])
414414

415+
base_ref = pr.get("baseRefName") or "main"
416+
merge_subject_prefixes = (
417+
f"merge branch '{base_ref}'",
418+
f"merge remote-tracking branch 'upstream/{base_ref}'",
419+
f"merge remote-tracking branch 'origin/{base_ref}'",
420+
f"merge {base_ref} into",
421+
)
422+
423+
def _is_merge_from_base(e: dict[str, Any]) -> bool:
424+
if e["kind"] != "commit":
425+
return False
426+
subject = ((e.get("body") or "").splitlines() or [""])[0].strip().lower()
427+
return any(subject.startswith(p) for p in merge_subject_prefixes)
428+
415429
# Last substantive event = last event whose body is non-empty OR whose
416-
# kind is not "review:COMMENTED" (state changes always count).
430+
# kind is not "review:COMMENTED" (state changes always count). Merges
431+
# of the base branch into the PR don't count as substantive — they
432+
# don't move the conversation forward.
417433
def is_substantive(e: dict[str, Any]) -> bool:
418434
if e["kind"].startswith("review:") and e["kind"] != "review:COMMENTED":
419435
return True
436+
if _is_merge_from_base(e):
437+
return False
420438
return bool((e.get("body") or "").strip())
421439

422440
substantive = [e for e in events if is_substantive(e)]

0 commit comments

Comments
 (0)