I just want to query the PRs from a specific user.
Do I need to use the head
param? But how?
https://api.github.com/repos/org-a/repo-b/pulls?state=open&per_page=1&head=owner:user-c
does not work.
API Refer: https://developer.github.com/v3/pulls/#list-pull-requests
Filter pull requests that someone has asked you directly to review: state:open type:pr user-review-requested:@me. Filter pull requests by the team requested for review: state:open type:pr team-review-requested:github/atom. Filter for pull requests that are linked to an issue that the pull request may close: linked: ...
Use the Search API and specify repo:REPO
, author:USER
and is:pr
filters:
https://developer.github.com/v3/search/#search-issues-and-pull-requests
For example, here are the pull requests from rails/rails
from aderyabin
:
https://api.github.com/search/issues?q=is:pr+repo:rails/rails+author:aderyabin
Here is the GraphQL API syntax to query the pull requests in the repo rails/rails
from the author aderyabin
:
{
search(query: "is:pr author:aderyabin repo:rails/rails", type: ISSUE, first: 100) {
issueCount
edges {
node {
... on PullRequest {
title
createdAt
url
}
}
}
}
}
The PullRequest object docs lists the fields available to query.
It doesn't seem to be possible at the moment to filter a user's PR for a given repo (or a repo's PR for a given user), but the same result can be achieved with the search
query above.
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