Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
3.0 KiB
Community PR Readiness Check — re-reviewing a PR you've already commented on
When looping over the GHC queue, skip PRs you reviewed before unless the contributor has actually done something. This avoids burning agent runs on PRs that are still waiting on the contributor.
What does "the contributor did something" mean?
Any of:
- New commit pushed (
committedevent) - Force-push / rebase (
head_ref_force_pushed) - Comment added (
commented) - Review submitted (
reviewed)
Label changes, description edits by us, and skill-posted comments don't count.
Use the GitHub Timeline API
The timeline endpoint returns every event on the PR with actor.login and a timestamp, so we can distinguish "contributor activity" from "skill activity" cleanly. This replaces an earlier heuristic that compared committedDate to the last skill comment — too narrow, since it missed contributor comments and force-pushes.
SKILL_USER=$(gh api user --jq .login)
gh api --paginate "repos/n8n-io/n8n/issues/<number>/timeline" \
-H "Accept: application/vnd.github+json"
Procedure
-
Resolve the skill user's login (
$SKILL_USERabove). This is the GitHub handle the skill is running as. -
Fetch the full timeline.
-
Find the last skill-authored event — any event where
actor.login == $SKILL_USER(labels applied, comments posted, etc.). Take its timestamp aslastSkillAt. If no skill activity exists → first-time review, run the full check. -
Scan for contributor activity after
lastSkillAt— events where:eventis one ofcommitted,head_ref_force_pushed,commented,reviewed,- AND, for
commented/reviewed/head_ref_force_pushed,actor.login != $SKILL_USER(skill comments shouldn't trigger re-review of themselves), - AND the event timestamp >
lastSkillAt.
Timestamp field varies by event type:
Event Timestamp field committedcommitter.datehead_ref_force_pushedcreated_atcommentedcreated_atreviewedsubmitted_at -
Decide:
- One or more qualifying events → run the full review (steps 2–7 in SKILL.md).
- None → skip the PR. Report "no contributor activity since previous review" and move on.
For committed events, there's no actor.login — the actor is the commit author email. Since the skill never pushes commits, treat every committed event as contributor activity unconditionally.
Edge case: description-only edits
Body edits don't generate timeline events, so a contributor who only updates the PR description (e.g. fills in a missing template section) won't be picked up. That's a GitHub API limitation; the skill can't see body edits without diffing against a cached snapshot.
If the user explicitly mentions a PR they edited, just re-review it — that's faster than working around the API.