Can't select my Pull Requests if there are too many new ones.

in utopian-io •  7 months ago

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:
image.png

Actual PRs:
image.png

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

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

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

  • Seems like you contribute quite often. AMAZING!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

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