0

I want to fetch all GitHub Pull Requests from repositories where I am a contributor. To do that, I first need to get all repositories where I have write access.

I tried calling the GitHub API endpoint:

GET /user/repos?affiliation=owner,collaborator

…but this only returns repositories I own or am directly added to as a collaborator on personal accounts. It does not include repositories in organizations where I have write access.

I then tried:

GET /user/repos?affiliation=owner,collaborator,organization_member

and filtered the results with permissions.push === true. This works for some repos, but it still misses organization repos where I have write access via team membership.

The problem is that to reliably get all repositories where I can contribute, I would have to fetch hundreds of repos and then call the collaborator permission endpoint for each one — which is inefficient.

Question:

Is there a better way to fetch only the repositories where I have write access, including organization repos where my access comes from team membership, using the GitHub API?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.