Skip to content

Commit 280c116

Browse files
committed
PR dashboard: skip merge-from-base commits in commit summary context
The is_substantive() filter already excludes "Update branch" merge commits from the latest-event determination, but the LLM-rendered context still surfaced them in the "Last N commits" listing and used their timestamp for "Last commit pushed". That made PRs where the only recent author activity was clicking "Update branch" (e.g. open-telemetry#18090) look like the author had just acted, pushing them into the approver bucket.
1 parent edbcfeb commit 280c116

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,14 +434,25 @@ def is_substantive(e: dict[str, Any]) -> bool:
434434
# context. Full commit messages and diffs travel via timeline events.
435435
commit_rows = []
436436
for c in recent_commits:
437-
sha = (c.get("sha") or "")[:7]
437+
sha_full = c.get("sha") or ""
438+
sha = sha_full[:7]
438439
msg = (c.get("commit") or {}).get("message", "").splitlines()[0] if c.get("commit") else ""
439440
a = c.get("author") or {}
440441
commit_login = a.get("login") or ((c.get("commit") or {}).get("author") or {}).get("name") or "?"
441442
commit_date = ((c.get("commit") or {}).get("author") or {}).get("date") or ""
442-
commit_rows.append({"sha": sha, "msg": msg, "author": commit_login, "date": commit_date})
443+
commit_rows.append({
444+
"sha": sha,
445+
"msg": msg,
446+
"author": commit_login,
447+
"date": commit_date,
448+
"is_merge": sha_full in merge_shas,
449+
})
443450

444-
last_commit_date = parse_ts(commit_rows[-1]["date"]) if commit_rows else None
451+
# "Last commit pushed" is meant to surface real author activity. Merge
452+
# commits from "Update branch" don't qualify, so skip them when picking
453+
# the timestamp.
454+
non_merge_rows = [r for r in commit_rows if not r["is_merge"]]
455+
last_commit_date = parse_ts(non_merge_rows[-1]["date"]) if non_merge_rows else None
445456

446457
# Checks summary.
447458
failing = [c for c in checks if (c.get("state") or "").upper() in ("FAILURE", "ERROR")]
@@ -543,7 +554,8 @@ def render_context(ctx: dict[str, Any]) -> str:
543554
# Commits
544555
lines.append(f"Last {len(ctx['commits'])} commits (oldest first):")
545556
for c in ctx["commits"]:
546-
lines.append(f" {c['sha']} {c['date'][:10]} @{c['author']}: {truncate(c['msg'], 120)}")
557+
suffix = " [merge from base — not a substantive change]" if c.get("is_merge") else ""
558+
lines.append(f" {c['sha']} {c['date'][:10]} @{c['author']}: {truncate(c['msg'], 120)}{suffix}")
547559
lines.append("")
548560

549561
# Last substantive event highlight

0 commit comments

Comments
 (0)