Unfortunately, the .../<owner>/<repo>/pulls
route doesn't currently allow this kind of query. To accomplish this, you need to use the general-purpose .../issues
route. In GitHub, a Pull Request is an instance of an Issue.
Adapt and curl the following URL (substitute <owner>
and <repo>
for your own):
https://api.github.com/search/issues?q=repo:<owner>/<repo>+is:pr+created:>=2020-08-15
A few remarks:
- I've left out the authentication part; use the strategy that fits your use case.
- The structure of the result is different: the
.../pulls
route returns an array, while the .../issues
route returns an object with an embedded array in the field items
. Also, the returned objects contain less information than what's returned by the .../pulls
route. For example, the merged_at
field is absent, as is the _links
field. However, in each PR object, there is a .pull_request.url
field containing an URL that will return all the PR data you would get from the .../pulls
URL, in the same format.
- If you need to filter by the
updated_at
date field, just put updated
instead of created
in the above query. closed
and merged
seem to also work.
- You can perform sorting of the results by appending something like
&sort=created&order=asc
to the query URL.
- Pagination is handled the same way: if your query results contain too many items, the link to the next page is provided in the header (use
-I
argument with curl), that you can grep with the regex '^link:.*?<([^>]+)>; rel="next".+'
to extract the next page's link in the first group.