This directory holds all the code (except for Actions Workflows) for our PR bot designed to improve the PR experience. For a list of commands to use when interacting with the bot, see Commands.md. For a design doc explaining the design and implementation, see Automate Reviewer Assignment
The bot consists of three core workflows and a persistent state tracking system:
processNewPrs.ts)awaiting triage)..github/REVIEWERS.yml (prioritizing least-recently-assigned reviewers).Next Action: Reviewers label.processPrUpdate.ts)synchronize), draft transitions (converted_to_draft, ready_for_review), and comments (issue_comment: created).Next Action: Author) when a PR is marked as draft (converted_to_draft) and back to reviewers (Next Action: Reviewers) when taken out of draft (ready_for_review) or when the author pushes new commits or posts comments on a non-draft PR.ready_for_review and has no reviewers assigned yet, immediately assigns reviewers if it already has matching reviewer labels and passing CI checks.slow-review label upon receiving a comment from a non-author reviewer.assign to next reviewer, waiting on author, stop reviewer notifications, assign set of reviewers, and remind me after tests pass.findPrsNeedingAttention.ts)awaiting triage).slow-review if inactive for ≥ 7 days (or ≥ 2 weekdays without comments).slow-review, and adds reassigned-reviewers.reassigned-reviewers and Next Action: Reviewers labels and review started > 60 days ago, it stops reviewer assignment loops and adds awaiting triage. PRs labeled awaiting triage are skipped.PersistentState)pr-bot-state Git branch under state/pr-state/pr-<number>.json and state/reviewers-for-label-<label>.json.To build, run:
npm install npm run build
To run the tests:
npm test
Before checking in code, run prettier on it:
npm run format