codecov / engineering-team

This is a general repo to use with GH Projects
1 stars 1 forks source link

Consider using GitHub GraphQL API for Commits #2357

Open Swatinem opened 2 months ago

Swatinem commented 2 months ago

As visible in this trace, we are making 3 different GitHub requests to fetch commit info and some related things:

Image

I wonder if its possible to use the GraphQL API for this, in order to merge these 3 different requests into one.

matt-codecov commented 1 month 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