I would like to write a script in Javascript to query all open github PRs in all repos in my org. I can use this URL to do it in a browser: https://my.github.server/pulls?q=is%3Aopen+is%3Apr+org%3Amy-org-name.
But using octokit, I need to supply the name of the repo in which to search. It looks as if the github API also requires it, but like I said, the URL above doesn't supply a repo name and it works just fine.
The documented one also has /repos at the beginning, which mine above does not. I can't find the one I'm using anywhere in the github API docs. If I try octokit.request( 'GET /pulls?q=...' ) as above, I get a 404.
I'm sure there's a way to list the repos and run the above search on each one, but I have dozens of repos, so that's likely to be much slower. Is there a way to do it in one request?
There is no direct way to fetch all open PRs across all repositories within an organization in a single request using GitHub's API or Octokit. The Search API can search for PRs but it doesn't support filtering by organization.
You can get a list of all repositories in the organization and use the list of repositories to get all pull requests for each repository.
Example:
Not sure how slow this will be in your case. I hope this helps anyway.