Auto-Assign Pull Requests on GitHub
March 21, 2020
Back when I was working at Echobind, we used a Slack + GitHub integration to notify you of PRs you needed to review. I loved it! As soon as a PR was assigned to me, I would get a ding on Slack. It worked really well.
Since we worked on small teams, the PR reviewers were always the same 1-2 devs. I thought,
Wouldn't it be great if we could auto-assign them?
Turns out you can! Here's how:
- Create a file called CODEOWNERS (no extension)
- Place it at the root or in the
.github
directory - Add the following code to your file:# Make @lukeskywalker @yoda reviewers for every file* @lukeskywalker @yoda
BOOM! And the cool part, you won't be assigned your own pull requests (I don't think you can be?)!
Note: you can get fancy and set up code owners for specific directories, extensions, etc. Read the docs.
If you prefer to learn by watching, you can find this on egghead.