A gh CLI extension that
adds Copilot as a reviewer on pull requests.
gh copilot-review is a simple CLI tool to request a GitHub Copilot Code Review on a pull request directly from your terminal. It streamlines the process of
invoking Copilot's PR review bot, saving you time and making it easier to get AI-powered feedback on your code changes.
gh extension install ChrisCarini/gh-copilot-reviewNote: This script requires the GitHub CLI (gh) to be installed and authenticated.
Request a Copilot code review on a GitHub pull request.
gh copilot-review [<number> | <url>]
Arguments:
- By number, e.g.
123 - By URL, e.g.
https://github.com/OWNER/REPO/pull/123
Examples:
gh copilot-review 353
gh copilot-review https://github.com/OWNER/REPO/pull/353
Note
GitHub has native functionality to enable automatic Copilot reviews. It's advised to use that, if able.
The below workflow is better suited for cases where more complex logic is desired.
Use the below workflow to automatically request a Copilot review on pull requests that match certain criteria.
name: Automatic Copilot Code Review
on:
pull_request:
types:
- opened # brand-new PRs
- ready_for_review # drafts marked “Ready for review”
- reopened # PRs that were closed then reopened
jobs:
add-copilot-to-pr-reviews:
name: "Add Copilot to PR reviews"
if: ${{ github.event.pull_request.draft == false }} # skip still-draft PRs
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GH_TOKEN_COPILOT_REVIEW }} # gh CLI picks this up automatically
steps:
- name: Install gh-copilot-review extension
run: gh extension install ChrisCarini/gh-copilot-review
- name: Ask Copilot to review this PR
run: gh copilot-review "${{ github.event.pull_request.html_url }}"You need to create a GitHub fine-grained personal access token (PAT) with the following permission:
Pull requests: Read and write
Then, add it as a secret to your repository. In the above example, the secret is named GH_TOKEN_COPILOT_REVIEW.
Note: As of 2025-09, the above link will deep-link you to the fine-grained PAT page with the correct permissions selected. (Thanks to @cole-hartman and @dorisbwang work adding Template URLs for fine-grained PATs)
This project was inspired by:
- a desire to automate adding Copilot to certain PRs
- indirect encouragement from a few colleagues looking for the same thing, and...
- the 🔑 piece, a comment on cli/cli/issues/10598#issuecomment-2893526162