Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I need to gather review statistics from GitHub on our project

I need to extract information from our private GitHub repo regarding the number of reviews each of our collaborators are doing during a set time period.

I've been reviewing the GitHub documentation but it's not obvious to me if it's even possible using their REST API.

I want to use the data to present the information in a graph online automatically, so REST is the prefered way.

Does anyone know if it's even possible?

Thanks, /J

like image 217
jBoive Avatar asked Feb 16 '17 07:02

jBoive


2 Answers

Here is a link to the list reviews on a pull request endpoint. The call will return user details so you can tally the volume of reviews and who performed them. Here is an example of the call:

curl -u <USER>:<API_KEY> https://api.github.com/repos/<owner>/<repo>/pulls/<number>/reviews

You can automate this further be generating a list of your organization's repositories, then pulling a list of the pull requests in each repository. The JSON payload of pull requests will include the id you'll need for generating the pull request review information.

like image 148
CJ Johnson Avatar answered Oct 06 '22 03:10

CJ Johnson


the best way is to use the GitHub API v4 (graphql) endpoints. The PullRequests object reviews attribute will let you get all the reviews for a repository PRs (the reviews attribute). You'll need to fetch the list of your repositories using the repositories attribute. The graphql API is more efficient than the rest API (v3).

Depending of the size of your repositories the crawler could be complex to build because you'll be face of any kind of corner cases such as network issues, API slowness, ...

I'm working on a project called monocle that gather repositories statistics about Pull Request on GitHub. Various metrics will be shown is form of graphs or lists. For instance you'll see the amount of reviews and/or comments done by someone to someone else. The tool also display a chord graph with the review strength between peers (see the attached picture).

Here is the project's GitHub page and a link to the demo node where various GitHub orgs are indexed here Ansible.

The tool is quite easy to deploy using docker compose.

enter image description here

like image 20
Fbo Avatar answered Oct 06 '22 03:10

Fbo