Skip to content

List all PRs awaiting review from a user #1794

Answered by gr2m
eliorivero asked this question in Q&A
Discussion options

You must be logged in to vote

What I would recommend to do is to use the search API. It supports the same options as the search on github.com, e.g. here are all the open pull requests that request a review by the authenticated user: https://github.com/pulls?q=is%3Aopen+is%3Apr+review-requested%3A%40me+

The code with @octokit/rest for that query would be

octokit.search.issuesAndPullRequests({
  q: 'is:open is:pr review-requested:@me'
})

To paginate all results, you can do

const results = octokit.paginate(search.issuesAndPullRequests, {
  q: 'is:open is:pr review-requested:@me'
})

Note that search API requests are much more rate-limited than other API requests. If you hit rate/abuse limits, consider using https://github…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by eliorivero
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants