Open Swatinem opened 2 months ago
this is a good idea but heads up: @ajay-sentry and i ran into a token issue we couldn't figure out when trying to use GH GraphQL in shared.torngit.github.list_repos()
using a GitHub Personal Access Token, i get the same list of repositories from the /user/repos
REST API endpoint and this GraphQL query. if i instead use the OAuth token that Codecov has for me, /user/repos
still works but the GraphQL query no longer returns private/internal repos. i think we both tried messing with affiliations
, ownerAffiliations
, and visibility
but couldn't get it working
there are some community discussions which imply GraphQL will only return private repos for GitHub App Installation tokens, but GH's GraphQL Explorer is regular OAuth and works as expected so that can't be it
As visible in this trace, we are making 3 different GitHub requests to fetch commit info and some related things:
GET https://api.github.com/repos/X/Y/commits/Z
GET https://api.github.com/repos/X/Y/commits/Z/pulls
GET https://api.github.com/repos/X/Y/commits/Z/branches-where-head
I wonder if its possible to use the GraphQL API for this, in order to merge these 3 different requests into one.