Skip to content

Commit e9d50b5

Browse files
Copilotvgrlria-gopusophietheking
authored
Add tutorial for using Copilot code review across the PR lifecycle (#62054)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: vgrl <vgrl@github.com> Co-authored-by: Ria Gopu <ria-gopu@github.com> Co-authored-by: Sophie <29382425+sophietheking@users.noreply.github.com>
1 parent 3294389 commit e9d50b5

2 files changed

Lines changed: 125 additions & 0 deletions

File tree

content/copilot/tutorials/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ children:
1111
- /budgets
1212
- /spark
1313
- /customize-code-review
14+
- /use-copilot-code-review-across-the-pull-request-lifecycle
1415
- /enhance-agent-mode-with-mcp
1516
- /compare-ai-models
1617
- /speed-up-development-work
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
---
2+
title: Use GitHub Copilot code review across the pull request lifecycle
3+
shortTitle: Pull request lifecycle
4+
allowTitleToDifferFromFilename: true
5+
intro: Build a repeatable workflow for {% data variables.copilot.copilot_code-review_short %} from draft pull request to merge.
6+
versions:
7+
feature: copilot
8+
contentType: tutorials
9+
category:
10+
- Accelerate PR velocity
11+
- Team collaboration
12+
- Author and optimize with Copilot
13+
---
14+
15+
## Introduction
16+
17+
{% data variables.copilot.copilot_code-review_short %} is most effective when you use it as part of a pull request workflow. This tutorial shows how to choose between manual and automatic reviews, request reviews early on draft pull requests, and decide when to trigger re-review before merge.
18+
19+
You will also learn when to use customization, skills, MCP servers, and runner options to tailor {% data variables.product.prodname_copilot_short %}'s reviews to your needs.
20+
21+
## Work through the pull request lifecycle
22+
23+
Choose a review model and set up early feedback for draft and active pull requests.
24+
25+
### Choose the right review model for your team
26+
27+
{% data variables.copilot.copilot_code-review_short %} can run manually, when you trigger it yourself, or automatically, at one or more points in a pull request's lifecycle. Manual reviews give you control over exactly when {% data variables.copilot.copilot_code-review_short %} weighs in. Automatic reviews ensure consistent coverage, and you can choose whether they trigger on open, on draft, or on every new push.
28+
29+
| Review model | Best for | Why |
30+
| --- | --- | --- |
31+
| Manual review request | High-context changes or selective use | You can trigger {% data variables.product.prodname_copilot_short %} only when you want another perspective. |
32+
| Automatic review on open pull requests | Teams that want broad, consistent coverage | Every pull request gets baseline feedback without relying on individual habits. |
33+
| Automatic review on draft pull requests | Teams that want earlier feedback loops | Authors can fix issues before human review starts. |
34+
| Automatic review on new pushes | Fast-moving pull requests with multiple revisions | {% data variables.product.prodname_copilot_short %} reevaluates substantial updates as the pull request evolves. |
35+
36+
For setup steps, see [AUTOTITLE](/copilot/how-tos/use-copilot-agents/request-a-code-review/use-code-review) and [AUTOTITLE](/copilot/how-tos/copilot-on-github/set-up-copilot/configure-automatic-review).
37+
38+
### Use {% data variables.copilot.copilot_code-review_short %} early on draft pull requests
39+
40+
Reviewing draft pull requests with {% data variables.copilot.copilot_code-review_short %} gives you an early, dependable check on your code before you request a review from your team.
41+
42+
A useful draft workflow is:
43+
44+
1. Open a pull request as draft.
45+
1. Request a review from {% data variables.copilot.copilot_code-review_short %} under **Reviewers**, or enable automatic review for draft pull requests.
46+
1. Address high-confidence feedback first, such as correctness, security, and clear maintainability issues.
47+
1. Push updates and confirm that major comments have been resolved.
48+
1. Mark the pull request as ready for human review.
49+
50+
This approach helps your team spend more human review time on design tradeoffs and product impact, instead of obvious issues that could have been caught earlier.
51+
52+
## Tune review quality
53+
54+
Improve review quality by deciding when to request re-review and where customization, external context, and runners add value.
55+
56+
### Use re-review before merge
57+
58+
After substantial changes, request re-review to check whether new risks were introduced while addressing earlier feedback.
59+
60+
Request re-review when you:
61+
62+
* Update multiple files across service or package boundaries.
63+
* Change security-sensitive or data-sensitive behavior.
64+
* Apply a large batch of suggested changes and want a final pass.
65+
66+
For teams with frequent updates to active pull requests, enabling automatic reviews on new pushes can reduce manual re-review requests while keeping feedback current.
67+
68+
### Match customization to your workflow
69+
70+
Customization is most useful when each file type supports a review decision point in your workflow:
71+
72+
* Use `.github/copilot-instructions.md` for repository-wide review expectations that should apply to most pull requests.
73+
* Use `.github/instructions/**/*.instructions.md` for agent-specific and path-specific guidance when different parts of the codebase have different standards.
74+
* Use `AGENTS.md` to provide repository context that improves relevance, such as intentional patterns, architecture boundaries, or review priorities.
75+
76+
Keep these files focused on what reviewers need to decide during pull requests. Avoid turning them into full engineering handbooks.
77+
78+
For detailed customization mechanics and examples, see [AUTOTITLE](/copilot/tutorials/customize-code-review).
79+
80+
### Use agent skills and MCP servers for specialized review goals
81+
82+
Agent skills and MCP servers are most valuable when your team needs reviews that depend on organization-specific context.
83+
84+
Use agent skills when you want reusable review routines, for example:
85+
86+
* Applying a standard checklist to migration pull requests.
87+
* Running language- or framework-specific review passes in a monorepo.
88+
* Prioritizing certain risk areas, such as authorization or billing logic.
89+
90+
Use MCP servers when reviews should reference context outside the pull request itself, for example:
91+
92+
* Linking pull request changes to issue, incident, or service ownership data.
93+
* Checking expected rollout or operational context from internal systems.
94+
* Validating implementation details against external documentation sources.
95+
96+
For setup details, see [AUTOTITLE](/copilot/how-tos/copilot-on-github/customize-copilot/customize-cloud-agent/add-skills) and [AUTOTITLE](/copilot/how-tos/copilot-on-github/customize-copilot/configure-mcp-servers).
97+
98+
### Decide whether you need self-hosted runners
99+
100+
In many cases, standard {% data variables.product.prodname_dotcom %}-hosted runners are sufficient for {% data variables.copilot.copilot_code-review_short %} and require no setup; they are configured for you by default.
101+
102+
Consider self-hosted or larger runners when you need:
103+
104+
* Better performance for heavier review workloads.
105+
* Network access to internal systems required by your organization.
106+
107+
Runners are required because {% data variables.copilot.copilot_code-review_short %} uses {% data variables.product.prodname_actions %} for agentic operations, such as deeper context gathering and tool-calling. If {% data variables.product.prodname_dotcom %}-hosted runners are unavailable and no supported self-hosted option is configured correctly, reviews will fall back to a more limited mode.
108+
109+
For planning and setup details, see [AUTOTITLE](/copilot/how-tos/copilot-on-github/set-up-copilot/configure-runners).
110+
111+
## Recommended workflows by scenario
112+
113+
| Team scenario | Recommended workflow |
114+
| --- | --- |
115+
| Small team with frequent pull requests | Enable automatic reviews for all pull requests, review drafts for early feedback, and use manual re-review before merge when changes are substantial. |
116+
| Large monorepo with mixed stacks | Enable automatic reviews and review new pushes, add path-specific instructions for each major area, and use skills for repeated review patterns. |
117+
| Security-sensitive or regulated codebase | Use draft pull request reviews plus required re-review before merge, keep repository-wide security expectations in `.github/copilot-instructions.md`, and use MCP servers for incident or compliance context stored outside of GitHub. |
118+
| Team with internal platform dependencies | Start with automatic review, then add self-hosted runners and MCP context only when internal-system access is required for useful review feedback. |
119+
120+
## Next steps
121+
122+
* For broader concepts, including review effort and agentic capabilities, see [AUTOTITLE](/copilot/concepts/agents/code-review).
123+
* To tune automated review quality for specific repositories, see [AUTOTITLE](/copilot/tutorials/optimize-code-reviews).
124+
* For excluded file types and other limits, see [AUTOTITLE](/copilot/reference/review-excluded-files).

0 commit comments

Comments
 (0)