Ganesa Vijayakumar
Ganesa Vijayakumar

Reputation: 2602

Are there any ways to get/export list of comments for particular project/branch in Github?

Are there any ways to get/export list of comments for particular project/branch in Github?

I found the below question which is related to this but seems the answer is only for getting the comments for a particular commit on Github.

Get list of comments from GitHub pull request

Thank you!

Upvotes: 1

Views: 2281

Answers (1)

peinearydevelopment
peinearydevelopment

Reputation: 11474

Relevant GitHub api documentation.

I think what you are looking for is something like this:

https://api.github.com/repos/{owner}/{repo}/comments

So if the repository you are interested in obtaining information for is angular, your request would be:

https://api.github.com/repos/angular/angular/comments

To obtain, all of the comments for that repository, you must know their Api limits to 100 results per request(and has some other limits, such as 60 unauthenticated requests per hour). So depending on how programmatically you are doing this, you would want to make your requests as follows:

https://api.github.com/repos/angular/angular/comments?page=1&per_page=100
https://api.github.com/repos/angular/angular/comments?page=2&per_page=100
etc...

UPDATE: Following the additional information provided in the comments, for this to work with a private repository, you would need to do two things.

  1. Update the url you are using to https://api.github.com/user/repos/{owner}/{repo}/comments Documentation
  2. Provide the appropriate authentication to the requests. One way to do this is through the headers. Add both of the following headers:
    • User-Agent: 'YOUR_USERNAME'
    • Authorization: 'token YOUR_TOKEN'

Upvotes: 1

Related Questions