Get repos from the GitHub GraphQL API which are owned by the authenticated user (owner of the token).
Instead of OWNER
, you can also change the ownerAffiliations
filter in the query to be COLLABORATOR
or ORGANIZATION_MEMBER
. Or omit the filter.
Instead of setting privacy
filter to PUBLIC
, you can set to PRIVATE
. Or omit the filter.
The API allows getting up to 100 repos on a page, as set here. For faster page loads when setting, a small number is useful.
To lookup repos for a target user by GH login, see this gist.
To get more than 100 repos in the results, you normally need paging, but there is a workaround here to get 100 original repos, 100 forks and 100 archived repos, effectively giving more than 100 repos.
This works great in the GH GraphQL explorer. If you run the request part of a script, the query might timeout every time because of the amount of data requested.
Then do each section in a separate script and query, or request fewer fields for each repo, or use paging to do more requests with fewer repos on each page (which gets complicated to page on three lists at the same time).
- GitHub GraphQL API links.