AI and developer tools
PRTrain: a merge train for pull requests
A Ruby service that tracks every pull request I have open and moves each one through review, issue updates, merge and cleanup on GitHub and Linear.
- 230+commits since February 2026
The problem
With a lot of small pull requests open at once, the busywork adds up: asking for review, nudging a stale review, moving the Linear issue along, merging when it’s green, and cleaning up after. Every one of those is easy and every one of them gets forgotten.
What I built
- A long-running service that syncs each pull request’s state from GitHub, in batches over GraphQL, and its linked issues from Linear
- A small state machine that decides what each pull request needs next, and a queue of scheduled actions to do it: request review, re-request after changes, resolve conversations, move issues along, merge, archive
- Dependencies between pull requests, so one waits until the one it depends on lands
The loop
- Tickevery minute or so
- SyncGitHub over GraphQL, Linear per issue
- Planwhat does each PR need next?
- Queueschedule an action
- Runreview, move issue, merge, archive
every max(60s, pr_count * 2s):
states = github.pull_request_states(prs, chunk = 20) # one GraphQL query per chunk
for pr in prs:
pr.sync(states[pr], linear.issues(pr))
next = plan_for(pr) # needs review? changes requested? green and approved?
if next and not pr.queue.has(next):
pr.queue.schedule(next, run_at = next_slot(next))
if action = queue.pop_due():
execute(action) # merges pin the head SHA they were approved on
Why it matters
It keeps my open work moving without me babysitting it, and reviewers get asked at a sensible pace instead of all at once.
Stack
The PRTrain repository is private, so there's no public link.