Sub topic 9
Setting up automatic reviews
This chapter assumes you can already request a Copilot review by hand from the Reviewers menu, and that you can create branches and pull requests. It also assumes you have admin rights on a repository if you want to use rulesets.
Why automate
Requesting a review by hand works, but people forget. Automatic reviews make Copilot a default step on every pull request, so authors get feedback before a human reviewer opens the diff. You can turn this on in two places: your personal settings, or a repository ruleset.
Two ways to turn it on
| Method | Who sets it | Scope | Typical use |
|---|---|---|---|
| Personal settings | Any user with Copilot access | Pull requests you author | You want feedback on your own work everywhere |
| Repository ruleset | Repository admin | Pull requests targeting the branches the ruleset covers | A team wants the same behavior for everyone |
The two methods are independent. A ruleset applies to everyone who opens a pull request against the targeted branches, whether or not each person turned on the personal setting.
Personal settings
Use this option when you want Copilot to review your pull requests without any repository changes.
- Open your GitHub settings and go to the Copilot section.
- Find the option for automatic Copilot code review.
- Enable it.
From then on, pull requests you open get a Copilot review without you selecting Copilot in the Reviewers menu. The setting follows your account, so it does not change how anyone else's pull requests are handled.
Repository rulesets
A ruleset is a named set of rules that GitHub enforces on branches or tags matching a pattern. One of the available rules requests a Copilot review automatically.
- Open the repository, then go to Settings, Rules, Rulesets.
- Create a new branch ruleset.
- Give it a name and set enforcement to Active.
- Under target branches, add the branches you want covered, such as the default branch.
- Enable the rule that automatically requests Copilot code review.
- Save the ruleset.
The rule has options that change when Copilot runs:
- Review new pushes: Copilot reviews again each time commits are pushed to the pull request. Without it, Copilot reviews only when the pull request is opened, and you re-request later reviews by hand, as covered in the earlier chapter on re-requesting.
- Review draft pull requests: Copilot also reviews pull requests still marked as draft. Without it, Copilot waits until the pull request is ready for review.
The exact option labels can change as GitHub updates the interface. If a label here does not match your screen, look for the closest wording.
Choosing the options
For a first rollout, a sensible configuration is:
- Target only the default branch, so you see how reviews behave before widening scope.
- Leave draft reviews off if authors often open drafts early to save work. Draft reviews can add noise while the code is still changing.
- Turn on review of new pushes if your team pushes small follow-up commits often and wants each one checked.
Combine this with repository custom instructions. Automatic reviews run on every pull request, so instructions that say what to skip, such as formatting the linter already enforces, cut noise at scale.
Common errors
- No review appears. Check that the ruleset enforcement is Active, not Disabled or Evaluate, and that the pull request's target branch matches the ruleset pattern.
- The author has no Copilot access. Review behavior depends on plan and enablement, which an earlier chapter covered. Confirm the plan includes code review.
- Copilot did not re-review after a push. The new-pushes option is off. Turn it on or re-request by hand.
- Treating the review as an approval. Copilot posts a review with the Comment status. It does not approve the pull request and does not satisfy a required-approvals rule.
Checking your setup
After saving, open a small test pull request against a covered branch. A Copilot review should appear on its own, and Copilot should be listed among the reviewers. If it does not, work through the common errors above.
Exercise
Your team wants Copilot to review every pull request into main, including after each new push, but not drafts. Which method do you use, and which options do you set?
Show answer
Use a repository ruleset that targets main, since a personal setting only affects the pull requests one person authors. Enable the rule that automatically requests a Copilot review, turn on review of new pushes, and leave review of draft pull requests off.