Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Ground Controller Lvl 1
Message 1 of 2

Is there any quick way to get comment count of all open pull request

I have a requirement to find count of comments in all open pull request of a repository

 

Only way i know is to get all open pull request from a repo and iterate each pull request and perform call like this

GET /repos/:owner/:repo/pulls/:pull_number/comments

and sum up those responses, But it is too costly

 

I also tried with this method ( Find review comments on all PR in a repo)

GET /repos/:owner/:repo/pulls/comments

and passed state = open as query param like this

https://api.github.com/repos/angular/angular/pulls/comments?per_page=30&state=open

But it returns review comments of all pull requests


Any efforts will be appreciated

1 Reply
Copilot Lvl 2
Message 2 of 2

Re: Is there any quick way to get comment count of all open pull request

this should get you started

{
  search(query: "repo:angular/angular is:pr is:open", type: ISSUE, first: 100) {
    edges {
      node {
        ... on PullRequest {
          number
          timelineItems(itemTypes: ISSUE_COMMENT, first:100){
            totalCount
          }
        }
      }
    }
  }
}