Skip to main content

Reviewing a pull request created by Copilot

After Copilot creates a pull request you should review it and comment on anything that needs changes.

谁可以使用此功能?

Copilot 编码智能体 可在未禁用该功能的存储库中,通过 GitHub Copilot Pro+、GitHub Copilot Business 和 GitHub Copilot Enterprise 计划使用。 Copilot 编码智能体 在 托管用户帐户 拥有的仓库中不可用。
Sign up for Copilot

注意

Copilot 编码智能体 为 公共预览版,可能会变动。 在预览期间,该功能的使用须遵循“GitHub 预发行许可条款”。

For an introduction to Copilot 编码智能体, see 关于 Copilot 编码代理.

Reviewing Copilot's changes

After Copilot has finished working on a coding task, and has requested a pull request review from you, you should review Copilot's work thoroughly before merging the pull request.

重要

If you have branch protection rules that require pull request approvals, and you initiate a pull request by assigning an issue to Copilot, you can approve the pull request, but your approval won't count toward the required number of approvals. Someone else must approve the pull request for it to be merged.

Additionally, if the "Require approval of the most recent reviewable push" setting is enabled, the final push to the pull request will require n + 1 approvals, where n is the number of required approvals. The person who initiated the original Copilot pull request can't be counted among the required reviewers for that final push—but if someone else requested the latest Copilot-generated change, their approval can count.

You can ask Copilot to make changes using pull request comments, or you can check out Copilot's branch and make changes yourself.

提示

We recommend you batch your review comments instead of submitting them individually.

When you leave a comment on Copilot's pull request, Copilot will consider your comment, and decide whether to start a new agent session to respond.

Copilot only responds to comments from people who have write access to the repository.

If Copilot starts a new agent session in response to your comment, an eyes emoji (👀) is added as a reaction to the comment, and a "Copilot has started work" event is added to the pull request timeline.

Screenshot of a pull request timeline with a review comment with the eyes reaction and a "Copilot started work" timeline event.

Copilot may ignore a comment if it considers that the comment was not intended for it. If you are sure that you want Copilot to respond to your comment, you can @mention Copilot by including @copilot in your comment.

提示

If you don't want Copilot to respond to comments on a pull request, you can unassign Copilot from the pull request. If you later reassign Copilot to the same pull request it will respond to new comments and push more changes. It will not respond to comments that were added while it was not assigned.

For more information, see the section "Use comments to iterate on a pull request" in Best practices for using Copilot to work on tasks.

Managing GitHub Actions workflow runs

GitHub Actions workflows will not run automatically when Copilot pushes changes to a pull request.

GitHub Actions workflows can be privileged and have access to sensitive secrets. 检查拉取请求中的拟议更改,确保您在拉取请求分支上自由运行您的工作流程。 应特别注意 .github/workflows/ 目录中影响工作流文件的任何拟议更改。

To allow GitHub Actions workflows to run, click the Approve and run workflows button in the pull request's merge box.

Screenshot of the merge box on a pull request from Copilot with the "Approve and run workflows" button.

Giving feedback on Copilot's work

You can provide feedback on Copilot's work using the feedback buttons on Copilot's pull requests and comments. We use your feedback to improve the product and the quality of Copilot's solutions.

  1. On a pull request or comment from Copilot, click the thumbs up (👍) or thumbs down (👎) button.
  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.

Further reading