Skip to content

Add "recentmerged" sort option for pulls API #34171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
MarkusAmshove opened this issue Apr 10, 2025 · 2 comments
Open

Add "recentmerged" sort option for pulls API #34171

MarkusAmshove opened this issue Apr 10, 2025 · 2 comments
Labels
topic/api Concerns mainly the API type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@MarkusAmshove
Copy link
Contributor

Feature Description

Currently the /repos/{orga}/{repo}/pulls endpoint supports the following sort options:

  • oldest
  • recentupdate
  • leastupdate
  • mostcomment
  • leastcomment
  • priority

I'm trying to get a list of PRs in the order they've been merged, from most recent to oldest.
Since the repository has a lot of PRs and I only want to collect PRs since a certain date (to generate a changelog), the API is called with pagination and the cancellaction condition for pagination is "any merged_at <= certain date".

The problem with my behavior currently is, that this stops at pulls that have been merged a long time ago but have been updated somehow (e.g. someone wrote a comment).
If I remove the recentupdate sort criteria, then I could miss old PRs that got merged later.

For performance reasons I can't read all PRs from the repository, even with state closed.

To support my use case, it would be great to have a sort type recentmerged, or something similar, which returns all PRs in the opposite order they've been merged (newest to oldest).

If I oversee a combination of options which would mimic this, I'd appreciate a hint to accomplish my use case :-)

Screenshots

No response

@MarkusAmshove MarkusAmshove added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Apr 10, 2025
@kemzeb kemzeb added the topic/api Concerns mainly the API label Apr 10, 2025
@delvh
Copy link
Member

delvh commented Apr 10, 2025

If I'm not wrong, that sort option doesn't even exist for the UI yet, correct?

Overall, I agree with the idea.
I had the same problem quite often already.
Only problem: I think issues and PRs share the same set of sort options, so we would also need to find a semantic meaning for issues.
Alternatively, we could either decouple the sort options or declare this sort option to not work for issues.
Nevertheless, if this issue is implemented, this sort option should also be included in the UI.

@MarkusAmshove
Copy link
Contributor Author

I think "recentclosed" would work for both and support my use case, because I already check the merged_at attribute to distinguish between closed and merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/api Concerns mainly the API type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests

3 participants