RESTv3: How to GET merged pull requests? #24879
-
Hello, https://developer.github.com/v3/pulls/#list-pull-requests mentions that state can be open , close d or all , however, there is no merged state. How can I list merged pull requests only? Best Regards, Ani |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments
-
searching for this as well :slight_smile: |
Beta Was this translation helpful? Give feedback.
-
The search API can search “merged pull requests” with “is:merged” operator. I hope this helps! |
Beta Was this translation helpful? Give feedback.
-
would it be easily possible to get the merged status of a branch? |
Beta Was this translation helpful? Give feedback.
-
Hello, Yes, this is helpful, thanks. I’ve been looking into it and am almost done with what I want to do. Unfortunately, I can’t find any information on how to sort by merged-asc / merged-desc via the Search API. This is possible in the web version of GitHub. I’ve read the documentation at https://help.github.com/articles/sorting-search-results/ and https://help.github.com/articles/sorting-issues-and-pull-requests/ but it has no documentation on the aforementioned sorting on the Search API The query I currently have is /search/issues?q=repo:rpcs3/rpcs3+is:pr+is:merged+merged:%3E2018-10-01&sort=merged /search/issues?q=repo:rpcs3/rpcs3+is:pr+is:merged+merged:%3E2018-10-01 url: https://api.github.com/search/issues?q=repo:rpcs3/rpcs3+is:pr+is:merged+merged:%3E2018-10-01 Edit1: &sort=merged doesn’t do anything, I wrongly assumed so. And I want to sort by the opposite order, just like it’s possible to do in the web version, as in is:pr is:merged sort:merged-asc merged:>2018-10-01 How can I apply such sorting via the Search API? Best Regards, Ani |
Beta Was this translation helpful? Give feedback.
-
Hi @anileo, I’m glad that helped! You can include the sort qualifier ie: Best, Andrea |
Beta Was this translation helpful? Give feedback.
-
Hello, Unfortunately this tag doesn’t sort by merged order. In fact, after taking a closer look, I noticed merge / closed sort it’s likely not implemented. sort:merge or sort:closed doesn’t do the intended sort on the web interface and on the search API it’s doing nothing (the default sorting by creation date is applied). For example, a small sample with (currently) 6 PRs search/issues?q=repo:rpcs3/rpcs3+is:pr+is:merged+merged:%3E2018-11-04+sort=author-date-asc
I already tried sort = merged, merged-asc, merged-desc, closed, closed-asc, closed-desc, none seem to make any effect. Would it be possible to implement sorting by closed/merged date? Best Regards, Ani |
Beta Was this translation helpful? Give feedback.
-
Hey @anileo, What do you see when: Best, Andrea |
Beta Was this translation helpful? Give feedback.
-
Hello, I get the same output as I would get with search/issues?q=repo:rpcs3/rpcs3+is:pr+is:merged+sort:author-date-asc+merged:%3E2018-10-01 I thought &sort=merged did anything because on the web interface adding it (“sort: merged-asc”) actually returns a different order than the default one even though it’s also not the correct one. I now realized that merge/closed datetime related sorting options are not implemented, because trying any sort that is not implemented (e.g. “sort: asdfgh”) will return the same output as trying “sort: merged-asc”. What does work differently is search/issues?q=repo:rpcs3/rpcs3+is:pr+is:merged+sort:author-date-asc+merged:%3E2018-10-01+sort:updated-asc which shows the PRs ordered by the last update order. However, this is not the effect I’m looking for, as a comment in a PR will change the last update date. I need to order by the “closed_at” parameter (close/merge datetime). Best Regards, Ani |
Beta Was this translation helpful? Give feedback.
-
Hmmm, I see what you are saying, there is a limitation the only sort orders we can use are the ones in the drop down below, I can definitely see how helpful it would be to have that option and I’m passing this feedback as a feature request. |
Beta Was this translation helpful? Give feedback.
-
is this also possible to have smth like: is_linked_to_issue: or is_related_to_issue: , for PRs? That would help a lot!
Thanks |
Beta Was this translation helpful? Give feedback.
The search API can search “merged pull requests” with “is:merged” operator.
https://help.github.com/articles/searching-issues/#search-based-on-the-state-of-an-issue-or-pull-request
I hope this helps!