Skip to main content

Configuring automatic code review by Copilot

Learn how to configure Copilot to automatically review pull requests.

About automatic code review

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 Pro 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".

Hinweis

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 Code Review 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 code review for all pull requests you create

Hinweis

This is only available if you are on the Copilot Pro or Copilot Pro+ plan.

  1. In the upper-right corner of any page, click your profile photo, then click Your Copilot.

  2. Locate the Automatic Copilot Code Review option and click the dropdown button.

    Screenshot of the "Automatic Copilot Code Review" setting with the dropdown menu displayed.

  3. In the dropdown menu, select Enabled.

Configuring automatic code review for a single repository

  1. Navigieren Sie auf GitHub zur Hauptseite des Repositorys.

  2. Wähle unter dem Namen deines Repositorys die Option Einstellungen aus. Wenn die Registerkarte „Einstellungen“ nicht angezeigt wird, wähle im Dropdownmenü die Option Einstellungen aus.

    Screenshot eines Repositoryheaders mit den Registerkarten. Die Registerkarte „Einstellungen“ ist dunkelorange umrandet.

  3. Klicke auf der linken Randleiste unter „Code und Automatisierung“ auf Regeln und dann auf Regelsätze.

    Screenshot: Randleiste der Seite „Einstellungen“ für ein Repository Das Untermenü „Regeln“ ist erweitert, und die Option „Regelsätze“ ist orange umrandet.

  4. Klicken Sie auf Neuer Regelsatz.

  5. Klicken Sie auf Neuer Branch-Regelsatz.

  6. Geben Sie unter „Regelsatzname“ einen Namen für den Regelsatz ein.

  7. Um den Regelsatz zu aktivieren, wählst du unter „Enforcement Status“ Active aus.

  8. Under "Target branches," click Add target and choose one of the options—for example, Include default branch or Include all branches.

  9. Under "Branch rules," select the Require a pull request before merging checkbox.

    This expands a set of subsidiary options.

  10. Select the Request pull request review from Copilot checkbox.

    Screenshot of the "Request pull request review from Copilot" branch ruleset option.

  11. At the bottom of the page, click Create.

Configuring automatic code review for repositories in an organization

  1. Wähle in der rechten oberen Ecke auf GitHub dein Profilfoto aus, und klicke dann auf Your organizations.

  2. Klicke neben der Organisation auf Einstellungen.

  3. Wähle auf der linken Randleiste im Abschnitt „Code, Planung und Automatisierung“ die Option Repository aus, und klicke dann auf Regelsätze.

    Screenshot: Seite „Einstellungen“ einer Organisation Auf der Randleiste ist ein Link mit der Bezeichnung „Regelsätze“ orange umrandet.

  4. Klicken Sie auf Neuer Regelsatz.

  5. Klicken Sie auf Neuer Branch-Regelsatz.

  6. Geben Sie unter „Regelsatzname“ einen Namen für den Regelsatz ein.

  7. Um den Regelsatz zu aktivieren, wählst du unter „Enforcement Status“ Active aus.

  8. Under "Target repositories," click Add target and choose either Include by pattern or Exclude by pattern.

  9. In the dialog box that's displayed, type a pattern that will match the names of repositories in your organization—for example, *feature to match all repositories with names that end in feature.

    For information about pattern-matching syntax, see Erstellen von Regelsätzen für Repositorys in deiner Organisation.

  10. In the dialog box, click Add inclusion pattern or Add exclusion pattern.

  11. Repeat the process for any additional patterns you want to add.

    Hinweis

    You can add multiple targeting criteria to the same ruleset. Exclusion patterns are applied after inclusion patterns. For example, you could include any repositories matching the pattern *cat*, and specifically exclude a repository matching the pattern not-a-cat.

  12. Under "Target branches," click Add target and choose one of the target options.

  13. Under "Branch rules," select the Require a pull request before merging checkbox.

    This expands a set of subsidiary options.

  14. Select the Request pull request review from Copilot checkbox.

  15. At the bottom of the page, click Create.