I would like to get all users and teams for a GitHub repository using the API. I can get the teams by using this:
Any pointers on how I could get all the information I need?
CodePudding user response:
Repository collaborators can be listed using the Collaborators API as follows:
[GET] /repos/{owner}/{repo}/collaborators
By default, you will get a list of all users with access to the repository. You can filter the returned result using the affiliation
parameter set to direct
in order to get only the users added directly. In your case, this would be only the user me
.
Example using the API with the GitHub command line tool:
gh api -X GET repos/{owner}/{repo}/collaborators -f affiliation='direct'