All work

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.

Personal project · 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

The loop

  1. Tickevery minute or so
  2. SyncGitHub over GraphQL, Linear per issue
  3. Planwhat does each PR need next?
  4. Queueschedule an action
  5. Runreview, move issue, merge, archive

A sketch of the idea, not the production code.

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.