EmbarkStudios / octobors

Rust program for automerging PRs based on a few rules
Apache License 2.0
40 stars 2 forks source link

Add workaround for getting pull request statuses when there are more then default page size #62

Closed bwestlin closed 1 month ago

bwestlin commented 1 month ago

Checklist

Description of Changes

We've been seeing issues for some time that octobors is not auto merging pull requests when it should have and it looks like the cause of this is that a status in required_statuses is not being found which means it will not be seen as a success. Digging into this it turns out that it seem to have to do with the number of statuses which in this case is above 30 and that the default page size for the github api is 30, which in turn means that all statuses will not be present.

The fix proposed here changes so that the max page size is 100 which should give some headroom. I didn't find any other solution so far then to replicate what combined_status_for_ref does in octocrab, ideally there could be a way to supply the page size to octocrab instead. Another option could be to look into using list_statuses combined with all_pages instead but that would be a bit more involved as one would get all statuses the CI has been through and have to sort out what was the latest for each context. The proper option would be to add pagination support for (https://docs.rs/octocrab/0.38.0/octocrab/repos/struct.RepoHandler.html#method.combined_status_for_ref) though but that will be a bit of change.