Introduction
GitHub Copilot can review your code and provide feedback. Where possible, Copilot's feedback includes suggested changes which you can apply with a couple of clicks.
For a full introduction to GitHub Copilot code review, see About Copilot code review.
Using Copilot code review
These instructions explain how to use Copilot code review in the GitHub website. To see instructions for other popular coding environments, use the tool switcher at the top of the page.
-
On GitHub.com, create a pull request or navigate to an existing pull request.
-
Open the Reviewers menu, then select Copilot.
-
Wait for Copilot to review your pull request. This usually takes less than 30 seconds.
-
Scroll down and read through Copilot's comments.
Copilot always leaves a "Comment" review, not an "Approve" review or a "Request changes" review. This means that Copilot's reviews do not count toward required approvals for the pull request, and Copilot's reviews will not block merging changes. For more details, see Approving a pull request with required reviews.
-
Copilot's review comments behave like review comments from humans. You can add reactions to them, comment on them, resolve them and hide them.
Any comments you add to Copilot's review comments will be visible to humans, but they won't be visible to Copilot, and Copilot won't reply.
Working with suggested changes provided by Copilot
Where possible, Copilot's feedback includes suggested changes which you can apply with a couple of clicks.
If you're happy with the changes, you can accept a single suggestion from Copilot and commit it, or accept a group of suggestions together in a single commit. For more information, see Incorporating feedback in your pull request.
Providing feedback on Copilot's reviews
You can provide feedback on Copilot's comments directly within each comment. We use this information to improve the product and the quality of Copilot's suggestions.
-
On a pull request review comment from Copilot, click the thumbs up (👍) or thumbs down (👎) button.
-
If you click the thumbs down button, you're asked to provide additional information. You can, optionally, pick the reason for your negative feedback and leave a comment before clicking Submit feedback.
Requesting a re-review from Copilot
When you push changes to a pull request that Copilot has reviewed, it won't automatically re-review your changes.
To request a re-review from Copilot, click the button next to Copilot's name in the Reviewers menu. For more information, see Requesting a pull request review.
Note
When re-reviewing a pull request, Copilot may repeat the same comments again, even if they have been dismissed with the "Resolve conversation" button or downvoted with the thumbs down (👎) button.
Enabling automatic reviews
By default, you manually request a review from Copilot on each pull request, in the same way you would request a review from a human. However, you can set up Copilot to automatically review all pull requests. See Configuring automatic code review by Copilot.
Customizing Copilot's reviews with custom instructions
Note
Custom instructions for Copilot code review are in public preview and are subject to change.
During the public preview, if you're using a Copilot Business or Copilot Enterprise plan, the organization or enterprise that provides your plan must have the Opt in to preview features setting enabled. See Managing policies and features for Copilot in your organization or Managing policies and features for Copilot in your enterprise
You can customize Copilot code review by adding a .github/copilot-instructions.md
file in your repository containing information that you want Copilot to consider when reviewing code. This is the same copilot-instructions.md
used by Copilot Chat. See Adding repository custom instructions for GitHub Copilot.
Example
This example of a .github/copilot-instructions.md
file contains three instructions that will be applied to all Copilot code reviews in the repository.
When performing a code review, respond in Spanish.
When performing a code review, follow our internal security checklist.
When performing a code review, focus on readability and avoid nested ternary operators.
Customizing Copilot's reviews with coding guidelines
Note
The custom coding guidelines feature is only available with the Copilot Enterprise plan, and is currently limited to selected customers.
This feature will be deprecated in favor of using Copilot custom instructions to customize Copilot code review.
When using Copilot code review to review changes in Visual Studio Code or the GitHub website, you can customize Copilot's review with custom coding guidelines written in natural language. Copilot will give feedback based on your coding guidelines when it reviews your code. For more information, see Configuring coding guidelines for GitHub Copilot code review.
Comments generated based on a coding guideline will include a message, highlighting their source.