Skip to main content

Using GitHub Copilot code review

Learn how to request a code review from GitHub Copilot.

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 GitHub 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, click the appropriate tab at the top of the page.

  1. On GitHub.com, create a pull request or navigate to an existing pull request.

  2. Open the Reviewers menu, then select Copilot.

    Screenshot of selecting 'Copilot' from the 'Reviewers' menu.

  3. Wait for Copilot to review your pull request. This usually takes less than 30 seconds.

  4. Scroll down and read through Copilot's comments.

    Screenshot of a code review left by Copilot.

    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.

  5. 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.

  1. On a pull request review comment from Copilot, click the thumbs up (👍) or thumbs down (👎) button.

    Screenshot showing a Copilot code review comment with the thumbs up and thumbs down buttons.

  2. 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.

    Screenshot of the form for providing additional information when you give negative feedback on a comment from Copilot.

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 GitHub Copilot.

Customizing Copilot's reviews with custom instructions

You can customize Copilot code review by adding custom instructions to your repository.

Repository custom instructions can either be repository wide or path specific. You specify repository-wide custom instructions in a .github/copilot-instructions.md file in your repository. You can use this file to store information that you want Copilot to consider when reviewing code anywhere in the repository.

You can also write instructions that Copilot will only use when reviewing code in files that match a specified path. You write these instructions in one or more .github/instructions/NAME.instructions.md files.

For more information, 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, apply the checks in the `/security/security-checklist.md` file.

When performing a code review, focus on readability and avoid nested ternary operators.