2

I don't see a clean/obvious way to do this using the github api. So I'm not even sure it's really that easy/feasible to do. Am I forced to compute this locally (eg: query for ALL the commits of a given repo, and then tally them by author?)

If there is a clean 1-2 API call step way, instead of iterating over all the commits, that would be great.

It's not a duplicate, because the other question is asking how to do this with command line. I need to only use the github API because I will be going over 200+ repos and it needs to be fully programatic, as it starts from the list repos api.

jthill
  • 55,082
  • 5
  • 77
  • 137
Zombies
  • 25,039
  • 43
  • 140
  • 225
  • Possible duplicate of [Git number of commits per author on all branches](https://stackoverflow.com/questions/9839083/git-number-of-commits-per-author-on-all-branches) – phd Feb 19 '18 at 21:31
  • 1
    Are you looking for this?: `https://api.github.com/repos/scala/scala/contributors`? Found this there: https://github.com/blog/643-contributors – Xavier Guihot Feb 19 '18 at 21:34
  • @XavierGuihot That would probably do it. Just as long as I can use that same api enterprise (after logging in of course). – Zombies Feb 19 '18 at 22:10

1 Answers1

6

Based on comment of Xavier Guihot, I add parameter for query

?q=contributions&order=desc

It become to

https://api.github.com/repos/scala/scala/contributors?q=contributions&order=desc

(You can use this extension https://chrome.google.com/webstore/detail/json-formatter/bcjindcccaagfpapjjmafapmmgkkhgoa?hl=en , it help you easy to view result)

Vy Do
  • 46,709
  • 59
  • 215
  • 313
  • 1
    This gets only 30 how do i get all ? – Sundeep Pidugu May 22 '19 at 06:12
  • Not sure if there's a specific query paramter, but you can use the `per_page=` query parameter to get the number of required results per page (max. 100), and also the `page=` query parameter to get the number of pages of results. Refer to the API doc for the repos endpoint - https://docs.github.com/en/rest/repos/repos#list-repository-contributors – srm May 24 '22 at 19:05