Code review is one of the most important checks in a pull request, but it can also become a bottleneck when a team has many changes waiting for review.
Developers often spend the first part of a review looking for issues that could have been caught earlier. Unused code, obvious bugs, missing validation, incorrect error handling, security concerns, and maintainability problems can all take time away from the deeper review work.
GitHub Copilot can be added to the pull request workflow to provide another review pass before code is merged. It can review pull requests, identify potential problems, explain its reasoning through review comments, and suggest changes.
The useful part is not treating Copilot as a replacement for human reviewers. The better approach is to use it as an additional review layer that handles routine checks while developers focus on architecture, business logic, and decisions that require project context.
What GitHub Copilot Code Review Does
GitHub Copilot code review can review changes in a pull request and leave comments about potential issues.
A typical workflow looks like this:
Developer creates pull request
|
v
CI builds
|
v
Copilot reviews changes
|
v
Developer checks findings
|
v
Human code review
|
v
MergeCopilot can identify potential problems in areas such as:
- incorrect logic
- security concerns
- error handling
- maintainability
- missing validation
- problematic patterns
- possible regressions
- code quality issues
The exact findings depend on the changed code, repository context, and review configuration.
The important point is that the review happens as part of the pull request workflow rather than requiring developers to copy code into another tool.
Why Add Another Review Layer?
A human reviewer and an automated reviewer do not have exactly the same strengths.
A human reviewer may focus on:
- architecture
- business requirements
- API design
- domain behavior
- performance trade-offs
- maintainability
- operational concerns
Copilot can provide another pass focused on the implementation details.
For example, imagine a pull request changes an API endpoint.
A developer may verify that the endpoint follows the application's architecture and business rules.
Copilot may additionally point out that:
- an input is not validated
- an exception is being swallowed
- a database query is executed repeatedly
- a sensitive value is being logged
- a null condition is not handled
Neither review should automatically replace the other.
Start With Manual Reviews
For a team introducing Copilot code review for the first time, manual review requests are a good starting point.
A developer can create a pull request and request a Copilot review when the code reaches a useful review stage.
This avoids immediately adding another automatic check to every pull request.
The workflow becomes:
Pull Request
|
+-- CI
|
+-- Copilot review
|
+-- Human review
|
+-- MergeThis is particularly useful while the team is learning what kinds of findings Copilot produces for its codebase.
Once the team understands the quality of the reviews, automatic reviews can be introduced.
Requesting a Copilot Review
On a GitHub pull request, Copilot can be selected as a reviewer when the feature is available for the repository and account.
The important workflow is straightforward:
- Create or open a pull request.
- Request Copilot as a reviewer.
- Wait for the review.
- Read the comments.
- Verify each finding against the actual code.
- Fix valid issues.
- Push the changes.
- Request another review when the changes are substantial.
Copilot's review should be treated like feedback from another reviewer, not as an automatically correct answer.
Automatic Reviews
Teams that want consistent coverage can configure automatic Copilot reviews.
Automatic review can be useful when developers frequently forget to request an additional review.
A typical process becomes:
Pull Request Opened
|
v
Automatic Copilot Review
|
v
Developer Fixes Issues
|
v
CI Checks
|
v
Human Review
|
v
MergeGitHub also supports automatic review of draft pull requests and review of new pushes, depending on the repository and account configuration.
This gives teams several choices instead of forcing every repository into the same review process.
Reviewing Draft Pull Requests
One useful approach is to run Copilot against draft pull requests.
Suppose a developer opens a draft PR while working on a feature.
Instead of waiting until the implementation is considered complete, Copilot can review the current changes.
The developer can then fix obvious issues before requesting human review.
For example:
Draft PR
|
+-- Copilot review
|
+-- Fix issues
|
+-- Push changes
|
+-- Human review
|
+-- Ready for mergeThis can reduce the amount of routine feedback appearing during the final human review.
Review New Pushes Carefully
A pull request can change significantly after its first review.
For example:
Commit 1
Add authentication
Commit 2
Fix authentication feedback
Commit 3
Add authorization
Commit 4
Refactor middlewareA review of only the first version is not enough.
Teams can configure Copilot to review new pushes so the review can be updated as the pull request changes.
However, this should be used thoughtfully.
A very active pull request may receive many updates. Running an expensive review after every small change may not provide enough value.
For teams with frequent pushes, define when another review is useful.
Do Not Treat Copilot Comments as Approval
This is one of the most important rules.
A Copilot review is another source of feedback.
It is not a substitute for engineering ownership.
A finding may be technically correct but irrelevant to the application's requirements.
For example, Copilot might suggest changing an implementation because it sees a general pattern that appears inefficient.
The developer may know that:
- the data set is intentionally small
- the method is called only once
- the code is part of a compatibility layer
- the behavior is required by a business rule
- the apparent duplication is intentional
The correct response is not to apply every suggestion automatically.
The correct response is to understand the finding first.
Example of a Useful Review
Consider this code:
public async Task<User> GetUser(int id)
{
var user = await _db.Users.FindAsync(id);
if (user == null)
{
return null;
}
return user;
}Depending on the application's nullable reference type configuration and surrounding code, a review may identify a problem with the return contract.
The developer can then decide whether the method should:
public async Task<User?> GetUser(int id)or throw an exception, or use another application-specific behavior.
The important part is that the review identifies a possible issue.
The developer still decides what the correct application behavior should be.
Use Repository Instructions
Generic code review becomes more useful when the reviewer understands the project's conventions.
A repository can provide Copilot with instructions about how code should be reviewed.
For example, a project may have rules such as:
Review API changes for authorization issues.
Check database operations for unnecessary repeated queries.
Flag logging of authentication tokens and personal data.
Prefer existing repository service patterns over introducing new abstractions.
Check new endpoints for validation and cancellation support.This is much more useful than a vague instruction such as:
Review the code carefully.GitHub supports repository-level Copilot instructions and more targeted instruction files for different areas of a codebase.
Example Repository Instructions
A repository could contain a Copilot instruction file such as:
Review all pull requests with the following priorities:
1. Check authorization before authentication-related changes.
2. Look for secrets or credentials in logs.
3. Check database queries for unnecessary repeated calls.
4. Check public API inputs for validation.
5. Prefer existing services and patterns already used in the repository.
6. Flag changes that can break backward compatibility.
7. Do not suggest refactoring code unless there is a concrete benefit.The goal is not to create a huge engineering handbook.
Keep review instructions focused on decisions that matter during pull request review.
Customize Reviews for Different Parts of a Repository
Large repositories often contain multiple technologies.
For example:
src/
Api/
Billing/
Identity/
Reporting/
tests/
Api.Tests/
Billing.Tests/
infrastructure/
Terraform/The review concerns are different in each area.
An API change may require authorization checks.
Billing code may require financial correctness.
Infrastructure changes may require security and access-control checks.
Path-specific instructions can help provide more relevant review guidance.
This becomes especially useful in monorepos where different teams own different parts of the system.
Security Review
Security is an area where automated review can be particularly useful.
A repository can explicitly tell Copilot to pay attention to:
- authorization
- authentication
- input validation
- insecure deserialization
- secret exposure
- unsafe file access
- injection risks
- unsafe redirects
- access control
- sensitive logging
For example:
Security review requirements:
- Check all new API endpoints for authorization.
- Flag secrets or credentials written to logs.
- Check user-controlled input passed to SQL or shell commands.
- Check file paths derived from user input.
- Look for authentication decisions based only on client-controlled values.This gives the review a clearer purpose.
It also helps developers understand why a particular comment was generated.
Do Not Make Copilot the Only Security Check
Automated code review should not become the organization's complete security process.
A production application may still require:
- dependency scanning
- secret scanning
- static analysis
- dynamic testing
- penetration testing
- threat modeling
- infrastructure review
- human security review
Copilot can contribute to the process, but it is only one layer.
A useful model is:
Developer
|
v
Copilot Review
|
v
Static Analysis
|
v
Tests
|
v
Human Review
|
v
Security Controls
|
v
MergeDifferent layers catch different classes of problems.
Join the conversation! Your thoughts help the community grow.