Can't select my Pull Requests if there are too many new ones.
The PR dropdown (e.g. when writing a new development contribution) does not show all your PRs.
Expected behavior:
You should be able to select all your merged PRs from the past 14 days for the selected project.
Actual behavior:
If your PRs are not within the last 30 PRs for the project, you are not able to select them, because the API only pulls the last 30 PRs. If your PR is not among them, you can't select it, even if it's within the last 14 days (according to the rules).
Selectable PRs:
Actual PRs:
How to reproduce:
Well... that's not really possible unless you have a merged PR somewhere and after that more than 30 other PRs have followed.
But I think there's no further information required.
https://github.com/utopian-io/utopian.io/blob/master/src/actions/pullRequests.js#L8
https://api.github.com/repos/${repository}/pulls?state=closed
only returns 30 results.
Safest approach would be to iterate through the pages (&page=2
, &page=3
and so on) until the 14 day age limit is reached (by checking the merged_at
property). There's also a per_page
parameter but that would only be a hotfix and not 100% reliable.
Additional info:
The GitHub API let's you only filter PRs by "closed or not" (state=closed
) which also includes PRs that were closed but not merged. "merged_at": null,
needs to be filtered out.
There's even a separate endpoint to check if PRs are merged or not.
See: https://developer.github.com/v3/pulls/#get-if-a-pull-request-has-been-merged
Posted on Utopian.io - Rewarding Open Source Contributors
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Hey @mkt I am @utopian-io. I have just upvoted you!
Achievements
Suggestions
Get Noticed!
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x