Skip to main content

About Copilot code review

Find out how Copilot can review pull requests for you.

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.

Copilot can review code written in any programming language.

This article provides an overview of Copilot 代码评审. For instructions on how to request a code review from Copilot, see Using GitHub Copilot code review.

Availability

Copilot 代码评审 is—with one exception—a premium feature, available with the Copilot 专业版, Copilot Pro+, Copilot Business, and Copilot Enterprise plans.

The exception is the review of a selection of code within a file in Visual Studio Code. This is a standard feature available to all Copilot users in VS Code.

If you receive Copilot from an organization then, to be able to request a pull request review from Copilot on GitHub.com or in GitHub Mobile, the Copilot in GitHub.com option must be enabled in the Copilot policy settings for the organization. See Managing policies and features for Copilot in your organization.

Code review monthly quota

When you assign Copilot as a reviewer for a pull request—or when you request Copilot to review all of your uncommitted changes in your IDE—your monthly quota of Copilot premium requests is reduced by one. For information about premium requests, see Requests in GitHub Copilot.

If a repository is configured to automatically request a code review from Copilot for all new pull requests, the premium request usage is applied to the quota of the pull request author. If a pull request is created by GitHub Actions or by a bot, the usage will apply to the user who triggered the workflow (if identifiable), or to a designated billing owner.

When you reach your monthly quota you will not be able to get a code review from Copilot until your quota resets—unless you upgrade your Copilot plan or enable additional premium requests.

Copilot 代码评审 in Visual Studio Code

Copilot 代码评审 in Visual Studio Code supports two types of review:

  • Review selection:
    • Highlight code and ask for an initial review.
    • Standard Copilot feature. No premium requests used.
    • Does not support custom instructions or custom coding guidelines.
  • Review changes:
    • Request a deeper review of all of your uncommitted changes.
    • Premium feature. Uses one premium request from your monthly quota per review.
    • Supports custom instructions and custom coding guidelines.

Validating Copilot code reviews

Copilot isn't guaranteed to spot all problems or issues in a pull request, and sometimes it will make mistakes. Always validate Copilot's feedback carefully, and supplement Copilot's feedback with a human review.

For more information, see Responsible use of GitHub Copilot code review.

About automatic pull request reviews

By default, Copilot will only review a pull request if it's assigned to the pull request in the same way you would assign a human reviewer. However:

  • Individual users on the Copilot 专业版 or Copilot Pro+ plan can configure Copilot to automatically review all pull requests they create.
  • Repository owners can configure Copilot to automatically review all pull requests in the repository that are created by people with access to Copilot.
  • Organization owners can configure Copilot to automatically review all pull requests in some or all of the repositories in the organization where the pull request is created by a Copilot user.

Triggering an automatic pull request review

After you configure automatic code review, Copilot will review pull requests in the following situations:

  • When a pull request is created as an "Open" pull request.

    A review is not triggered if the pull request is created as a "Draft" pull request.

  • The first time a "Draft" pull request is switched to "Open".

注意

Copilot only automatically reviews a pull request once. If you make changes to the pull request after it has been automatically reviewed and you want Copilot to re-review the pull request, you must request this manually. To do this, click the button next to Copilot's name in the Reviewers menu.

Limits on automatic pull request reviews

Copilot 代码评审 is a premium feature with a per-person monthly quota. When Copilot carries out an automatic review, it uses one premium request from the quota of the user who created the pull request. For more information, see Using GitHub Copilot code review.

Configuring automatic pull request reviews

For details of how to configure Copilot to automatically review new pull requests, see Configuring automatic code review by Copilot.

Further reading