The v3 API has a way to ask a specific repository about pulls it has that correspond to a specific
I use that, but if a repository has 1000 forks, and I want to know if a branch in one of the repositories in the network is attached to PRs, then I’d need to perform 1000 API calls (one per each repository in the network).
This seems incredibly expensive/unwieldy.
Notably, even listing forks would require at least 10 API calls:
And technically because it doesn’t support continuations, 10 API calls could have holes or duplicates if someone adds/removes a fork at some inopportune moment (I perform both actions regularly).
In case people are curious, I know of a number of branches that are tied to PRs in multiple repositories concurrently. i.e. The answer to “where is the PR associated with branch X in repository Y” is “PR#a in repo B” and “PR#c in repo D”. Thus it isn’t even sufficient to “stop at first hit”.
And in case one might think “aha, but all forks are created equal”, this is false. Each repository has:
- its own set of enabled/disabled workflows
- its own set of repository / organization secrets
I know the v4 GraphQL API exists, and I’ve used it occasionally, but I really can’t figure out if I can use it to solve this problem.
Further, the GraphQL API doesn’t let me exclude, e.g.
isArchive repositories – it’s possible to query for them, but I’d have to client side iterate over my 10+ 100 repository queries just trying to find stuff I care about.