Skip to content

allow to assign Copilot as reviewer using gh cli #10598

Closed

Description

@linnefromice

Describe the feature or problem you’d like to solve

I would like to do this copilot review function with gh cli

https://docs.github.com/en/copilot/using-github-copilot/code-review/using-copilot-code-review

Proposed solution

I image the following commands to be assigned

gh pr edit (pr-number) --add-assignee "Copilot"
gh pr edit (pr-number) --add-copilot-to-assignee

Activity

  1. williammartin commented on Mar 17, 2025

    @williammartin
    Member

    Hey @linnefromice, unfortunately this isn't possible at the moment because the API doesn't really support it. There is an internal issue about making this possible. I will leave this open and blocked for the meantime, and update it when I know more.

  2. added
    platformProblems with the GitHub platform rather than the CLI client
    gh-prrelating to the gh pr command
    and removed on Mar 17, 2025
  3. ChrisCarini commented on Apr 17, 2025

    @ChrisCarini

    Hi @williammartin - any updates here at all?

  4. MissingRoberto commented on May 20, 2025

    @MissingRoberto

    @williammartin 😉 😉

  5. williammartin commented on May 20, 2025

    @williammartin
    Member

    Hey folks, right now you can do something like this:

    gh alias set save-me-copilot 'api --method POST /repos/$1/pulls/$2/requested_reviewers -f "reviewers[]=copilot-pull-request-reviewer[bot]"'
    
    gh save-me-copilot github/github-mcp-server 412
    

    And it will request copilot as a reviewer. This is not built into the CLI yet directly because the code review team are looking at the API they want to provide as a first class piece of work, and this is kinda a bit janky putting the bot name in there, but it does work, and I have no reason to believe it will stop working.

    Hope this helps.

  6. MissingRoberto commented on May 21, 2025

    @MissingRoberto

    a bit clunky for now as you must know / type the PR number and repo but works :)

    Image

    Thank you for finding a workaround @williammartin !

  7. williammartin commented on May 21, 2025

    @williammartin
    Member

    What UX would you like to see as first class support in the CLI?

  8. MissingRoberto commented on May 21, 2025

    @MissingRoberto

    I only use a subset of the commands offered by GH CLI but I would say that we would need at least something flag for creating a PR and then command for just that so that you can review or assign the PR.

    I am not sure if it should be part of copilot or on the pr subcommands.

    gh copilot pr review
    gh copilot pr assign
    

    or

    gh pr copilot review
    gh pr copilot assign
    gh pr create --review-with-copilot
    

    I think it would also be fine with the name used for the reviewer or assignee as people normally look at the users in the PR to know what to put on those flags:

    gh pr create --reviewer "Copilot"
    gh pr edit (pr-number) --reviewer "Copilot"
    gh pr edit (pr-number) --assignee "Copilot"
    
  9. ChrisCarini commented on May 21, 2025

    @ChrisCarini

    Nice! Thank you William! I was trying many different ways to try and automate getting Copilot added via gh CLI several weeks ago, but had no success - thank you! 🙏

    ✨ a (super simple/trivial) gh extension:

    I created a (super simple/trivial) gh extension that wraps the command you shared; installation and usage below:

    gh extension install ChrisCarini/gh-copilot-review
    
    gh copilot-review [<number> | <url>]
    

    Open to any and all feedback, suggestions, and contributions/PRs from folks! 🙏

    Note: I was really hoping to be able to make a gh extension that'd allow invoking my extension via something like gh pr copilot ..., but I didn't see if that was possible at all. If that is possible somehow, please let me know! 🙏

    Usability / UX in gh-proper CLI

    I did hunt around a bit to try and see what command(s) seemed most natural to add Copilot to a PR, and nothing felt super 'natural' to me. However, I will say that the current way in gh CLI to add a reviewer is gh pr edit [<url> | <number>] --add-reviewer ChrisCarini, so I naturally tried using copilot-pull-request-reviewer[bot], but I'm sure as you're aware, that did not work. Maybe a natural extension off of "what's already there" would be gh pr edit [<url> | <number>] --add-copilot.

  10. takaram commented on May 26, 2025

    @takaram

    v2.73.0 added support for --add-assignee @copilot.
    For consistency, I believe the solution for this issue should be adding --add-reviewer @copilot support for gh pr create/edit.

  11. dnv-ericliu commented on Jul 17, 2025

    @dnv-ericliu

    Hey @linnefromice, unfortunately this isn't possible at the moment because the API doesn't really support it. There is an internal issue about making this possible. I will leave this open and blocked for the meantime, and update it when I know more.

    It seems not working in github workflow 😓

  12. ChrisCarini commented on Jul 17, 2025

    @ChrisCarini

    Hey @linnefromice, unfortunately this isn't possible at the moment because the API doesn't really support it. There is an internal issue about making this possible. I will leave this open and blocked for the meantime, and update it when I know more.

    It seems not working in github workflow 😓

    Did you try changing the token permissions? For the gh-CLI extension I mentioned above, you need to use a token with the correct permissions: https://github.com/ChrisCarini/gh-copilot-review?tab=readme-ov-file#token-permissions - perhaps that's similar for whatever workflow you are trying? 🤷

  13. dnv-ericliu commented on Aug 1, 2025

    @dnv-ericliu

    Hey @linnefromice, unfortunately this isn't possible at the moment because the API doesn't really support it. There is an internal issue about making this possible. I will leave this open and blocked for the meantime, and update it when I know more.

    It seems not working in github workflow 😓

    Did you try changing the token permissions? For the gh-CLI extension I mentioned above, you need to use a token with the correct permissions: https://github.com/ChrisCarini/gh-copilot-review?tab=readme-ov-file#token-permissions - perhaps that's similar for whatever workflow you are trying? 🤷

    I got it work with gh api and PAT

  14. pioterj commented on Mar 11, 2026

    @pioterj

    Looks like this just got addressed in https://github.com/cli/cli/releases/tag/v2.88.0. 🎉

  15. BagToad commented on Mar 11, 2026

    @BagToad
    Member

    Thank you @pioterj! Yes, this is now available. There's also a blog about it here: https://github.blog/changelog/2026-03-11-request-copilot-code-review-from-github-cli/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIgh-prrelating to the gh pr commandplatformProblems with the GitHub platform rather than the CLI client

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions