Given a user's id, I want to get all pull requests where they are a requested reviewer.
The following won't work as it only allows me to get pull requests opened by that user:
query {
node(id: "$user") {
... on User {
pullRequests(first: 100) {
nodes {
reviewRequests(first: 100) {
nodes {
requestedReviewer {
... on User {
id
}
}
}
}
}
}
}
}
}
Is there a way to do this?
Thanks!
You can get username from the user id and perform a search with review-requested
to match a user requested for review :
get username :
{
node(id: "MDQ6VXNlcjk2OTQ3") {
... on User {
login
}
}
}
get open PR where user is review requested :
{
search(query: "type:pr state:open review-requested:refack", type: ISSUE, first: 100) {
issueCount
pageInfo {
endCursor
startCursor
}
edges {
node {
... on PullRequest {
repository {
nameWithOwner
}
number
url
}
}
}
}
}
You can define the query string as a variable, try it in the explorer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With