Skip to content

gh pr view --json comments does not include review comments #11477

Open

Description

@victorlin

Describe the bug

gh pr view --json comments does not include review comments (those attached directly to the review or to a file/inline).

Affected version

gh version 2.76.2 (2025-07-30)
https://github.com/cli/cli/releases/tag/v2.76.2

Steps to reproduce the behavior

  1. Run gh pr view https://github.com/cli/cli/pull/3 --json comments
  2. See empty comments array in output

Expected vs actual behavior

The option is documented to "view pull request comments". Review comments are shown and marked as comments in the web view, so I would expect them to appear in the output of this command.

Logs

Paste the activity from your command line. Redact if needed.

$ GH_DEBUG=true gh pr view https://github.com/cli/cli/pull/3 --json comments
⣾* Request at 2025-08-08 09:35:09.974193 -0700 PDT m=+0.186090417
* Request to https://api.github.com/graphql
⣻* Request took 298.693959ms
{
  "comments": []
}

Activity

  1. BagToad commented on Aug 12, 2025

    @BagToad
    Member

    👋 Hey @victorlin, thanks for the issue ✨

    I think you need reviews in addition to comments because comments made as a review aren't included in comments:

     gh pr view https://github.com/cli/cli/pull/3 --json reviews
    {
      "reviews": [
        {
          "id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3Mjk4NjU3MzE5",
          "author": {
            "login": "mislav"
          },
          "authorAssociation": "CONTRIBUTOR",
          "body": "Awesome! 🎉 ",
          "submittedAt": "2019-10-08T10:01:56Z",
          "includesCreatedEdit": false,
          "reactionGroups": [],
          "state": "APPROVED",
          "commit": {
            "oid": "996619ea3cf9d0534e98e6a65c64688efd629d1d"
          }
        },
        {
          "id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3Mjk5MTMzMzI4",
          "author": {
            "login": "tierninho"
          },
          "authorAssociation": "CONTRIBUTOR",
          "body": "Based on the commits, it looks as if this is the change. The bold, cyan text for the branch name.\r\n\r\n![Screen Shot 2019-10-08 at 3 45 06 PM](https://user-images.githubusercontent.com/14828183/66445516-c516d780-e9e2-11e9-9334-785f1e7f7b24.png)\r\n![Screen Shot 2019-10-09 at 10 41 58 AM](https://user-images.githubusercontent.com/14828183/66518773-ac113380-ea81-11e9-8ae9-7440b1d8757c.png)\r\n",
          "submittedAt": "2019-10-09T01:46:38Z",
          "includesCreatedEdit": false,
          "reactionGroups": [
            {
              "content": "THUMBS_UP",
              "users": {
                "totalCount": 1
              }
            }
          ],
          "state": "APPROVED",
          "commit": {
            "oid": "996619ea3cf9d0534e98e6a65c64688efd629d1d"
          }
        },
        {
          "id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3Mjk5NjY3OTEx",
          "author": {
            "login": "probablycorey"
          },
          "authorAssociation": "CONTRIBUTOR",
          "body": "",
          "submittedAt": "2019-10-09T20:12:10Z",
          "includesCreatedEdit": false,
          "reactionGroups": [],
          "state": "COMMENTED",
          "commit": {
            "oid": "996619ea3cf9d0534e98e6a65c64688efd629d1d"
          }
        }
      ]
    }
    

    However, it seems like this is still missing reviewThreads 🤔 which includes comment threads made on the lines of code.

    Here's an example:

    gh api graphql -f query='
    query PullRequestByNumber($owner: String!, $repo: String!) {
      repository(owner: $owner, name: $repo) {
        pullRequest(number: 3) {
          reviewThreads(first: 100) {
            nodes {
              id
              comments(first: 100) {
                nodes {
                  id
                  author {
                    login
                  }
                  bodyText
                }
              }
            }
          }
          id
          number
        }
      }
    }' -f owner=cli -f repo=cli
    {
      "data": {
        "repository": {
          "pullRequest": {
            "reviewThreads": {
              "nodes": [
                {
                  "id": "MDIzOlB1bGxSZXF1ZXN0UmV2aWV3VGhyZWFkMjA0NTczNjk1OnYy",
                  "comments": {
                    "nodes": [
                      {
                        "id": "MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMzMjQzMDc1Mg==",
                        "author": {
                          "login": "mislav"
                        },
                        "bodyText": "Should the branch name also include the OWNER: portion if the pull request is coming from a different repo? This would match how head branches are shown on GitHub web."
                      },
                      {
                        "id": "MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMzMzIxMDA4Nw==",
                        "author": {
                          "login": "probablycorey"
                        },
                        "bodyText": "That's a good idea. When this goes into master let's do it!"
                      }
                    ]
                  }
                }
              ]
            },
            "id": "MDExOlB1bGxSZXF1ZXN0MzI1NDMzODg1",
            "number": 3
          }
        }
      }
    }

    So I think the request here is to add reviewThreads as a --json option, is that right @victorlin?

  2. self-assigned this
    on Aug 12, 2025
  3. added
    enhancementa request to improve CLI
    and removed
    bugSomething isn't working
    on Aug 12, 2025
  4. github-actions commented on Aug 12, 2025

    @github-actions
    Contributor

    Thank you for your issue! We have categorized it as a feature request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.

    Unless you see the help wanted Contributions welcome label, we are not currently looking for external contributions for this feature.

    If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.

  5. added
    more-info-neededMore info needed from user/contributor
    gh-prrelating to the gh pr command
    on Aug 12, 2025
  6. victorlin commented on Aug 21, 2025

    @victorlin
    Author

    So I think the request here is to add reviewThreads as a --json option, is that right @victorlin?

    Yes, that sounds about right. I still think it's confusing that these would need to be handled separately from comments as they are described as comments in the UI and docs, but I see how that can be out of scope for the CLI.

  7. github-actions commented on Sep 21, 2025

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had any activity in the last 30 days,
    and it will be closed in 30 days if no further activity occurs.

    If you think this is a mistake, please comment on this issue to keep it open.

  8. A4-Tacks commented on Oct 5, 2025

    @A4-Tacks
    Contributor

    but I see how that can be out of scope for the CLI.

    I almost only use gh-cli to work, but I need to open my email when viewing reviews,
    this feature is very necessary feature for me

  9. removed their assignment
    on Oct 6, 2025
  10. BagToad commented on Oct 6, 2025

    @BagToad
    Member

    So I think the request here is to add reviewThreads as a --json option, is that right @victorlin?

    Yes, that sounds about right. I still think it's confusing that these would need to be handled separately from comments as they are described as comments in the UI and docs, but I see how that can be out of scope for the CLI.

    Sorry @victorlin I missed replying to this. Thanks for confirming! I put this on our list of enhancements to review and discuss in our monthly enhancement review.

  11. A4-Tacks commented on Oct 22, 2025

    @A4-Tacks
    Contributor

    I almost only use gh-cli to work, but I need to open my email when viewing reviews, this feature is very necessary feature for me

    I wrote a bash script to implement this feature and provide output similar to gh-cli

    https://github.com/A4-Tacks/my-bash-utils/blob/main/github-reviews

  12. Benkovichnikita commented on Dec 9, 2025

    @Benkovichnikita

    @victorlin @A4-Tacks

    You can use an extension gh extension install agynio/gh-pr-review.

    To read PR comments (including inline) you can run gh pr-review review view -R owner/repo

    https://github.com/agynio/gh-pr-review

  13. A4-Tacks commented on Dec 9, 2025

    @A4-Tacks
    Contributor

    To read PR comments (including inline) you can run gh pr-review review view -R owner/repo

    This seems inferior to my bash script, which performs certain rendering, patch highlighting, and date formatting

    And gh-pr-review seems to be simply filtering the JSON returned by the API, and it needs to specify the --repo parameter at all times

    And I just need clean review comment output and reply to review comments, which I have already solved using bash scripts

  14. art-shen commented on Jan 12, 2026

    @art-shen

    Coding agents often fail to do that properly without comprehensive guidance. It's so frustrating.

  15. lkiii commented on Feb 20, 2026

    @lkiii

    Would be great to have option to get something similar to this via gh pr view

    gh api graphql -f query='query {
      repository(owner: "owner", name: "repo") {
        pullRequest(number: 99) {  
          title
          url
          comments(first: 100){
            nodes {
              id
              body
              author { login }
              createdAt
            }
          }
          reviewThreads(first: 100) {
            nodes {
              isResolved
              isOutdated
              path
              line
              startLine
              diffSide
              comments(first: 50) {
                nodes {
                  id
                  author { login }
                  body
                  createdAt
                  path
                  line
                }
              }
            }
          }
        }
      }
    }' | jq .data.repository
    
  16. A4-Tacks commented on Feb 21, 2026

    @A4-Tacks
    Contributor

    At least one bash script is available that outputs something similar to gh pr view

    https://github.com/A4-Tacks/my-bash-utils/blob/main/github-reviews

  17. Willaaaaaaa commented on Mar 16, 2026

    @Willaaaaaaa

    The feature is also what I'm looking for. Currently, I can use gh api to get review comments, which is really inconvenient, like this: gh api repos/<org>/<repo>/pulls/<pr_id>/comments (jq is usually helpful here). But a more convenient way is always better.

    I think you need reviews in addition to comments because comments made as a review aren't included in comments

    I think we should consider review comments as a part of gh pr view --comments <url> outputs. This is more intuitive, I would say.

    @BagToad Is there any updates that you would like to share with us? I really think this really is something that could make gh cli tool better. Hopefully, the feature is coming soon❤

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 commandneeds-triageneeds to be reviewed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions