Pull request object does not have comments


#1
{
  search(query: "type:pr repo:org/repo-name updated:>2018-04-01T00:00:00Z", type: ISSUE, first: 100) {
    issueCount
    edges {
      node {
        ... on PullRequest {
          number
          title
          createdAt
          mergedAt
          closedAt
          lastEditedAt
          comments {
            totalCount
          }
          participants (first: 10) {
            edges {
              node {
                login
              }
            }
          }
          assignees(first: 10) {
            totalCount
            nodes {
              login
            }
          }
        }
      }
    }
  }
}

returns comment count as 0, always. I do see the comments in the UI.

The same behaviour seems to persist with Github API v3 (REST).

"comments": 0,

#2

Seems like I can get the comments like this

         reviews (first: 100) {
            totalCount 
            edges {
              node {
                comments {
                  totalCount
                }
              }
            }
          }

#3

@leonkyr It seems like this is because of how the APIs handle regular comments and review comments differently. On a PR with no regular comments and only review comments, comments will return 0. Does that match with your observations?

If so, we can definitely look into clarifying this field description. It’s definitely misleading.

Thanks for reporting this :slight_smile:


#4

Yes, I found more details in v3 rest api docs, there are 3 ways to get comments: commit, PR review and issue comments.