Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the number of collaborators in someone else's GitHub repository?

Tags:

github

I tried to use the number of committers who merged pull requests into the master branch. However, I cannot consider the reject action.

In GitHub, is there a way I can see the number of collaborators within someone else's repository?

like image 424
J. Lee Avatar asked May 28 '16 05:05

J. Lee


2 Answers

The GitHub API v3 has an endpoint for listing collaborators:

GET /repos/:owner/:repo/collaborators

To use it, you need to authenticate, and you have to be one of those collaborators or you'd see this:

{
  "message": "Must have push access to view repository collaborators.",
  "documentation_url": "https://developer.github.com/v3"
}

I've noticed that when you go to the Issues section of a repository and filter by author or assignee, you get a drop-down listing the repository's collaborators. The HTML content of this drop-down is loaded on demand, in a separate GET request, for example:

https://github.com/Leaflet/Leaflet/issues/show_menu_content?partial=issues/filters/authors_content
  • This is a hack. The URL is obviously not intended for programmatic consumption. Output is HTML, which may change. There's no warranty: use at your own risk.
  • This URL works for everyone, you don't even need to be logged into GitHub. If you're logged in, your account will appear first in the list.
  • This URL works even on repositories with Issues disabled.
like image 124
approxiblue Avatar answered Nov 16 '22 04:11

approxiblue


I had a similar need. So, i went and found the details of all PushEvent, CreateEvent and PullRequestEvent made on the master branch of the repository from githubarchive database hosted on google bigquery. From this, I could get a conservative estimate of all the users who are collaborators. Every PullRequestEvent that is merged results in a push event with the name of the collaborator who merged the request. However, if a PullRequestEvent is rejected, I had to look at who closed the PullRequest and if it is not the user that originally created the pull request then that person is also a collaborator. I am not sure if this is the best way to do this, but this is all I could think off.

like image 39
Poonacha Avatar answered Nov 16 '22 03:11

Poonacha