microplane
microplane copied to clipboard
Correctly fetch Github PR status
Fetch everything that makes a PR green, including the Status API and the Checks API.
Fixes #107
@benwaffle thanks for the contribution! Didn't realize that there was a distinction between commit statuses and checks. The graphql addition is neat but I am hesitant to add it since we don't use graphql at Clever and so something like the query
struct with all of it's graphql annotations would present a challenge for the team to understand and maintain. If there's a way to do this with the non-graphql API that would be preferred. Thanks again for this PR.
@robherley there's a REST API for this too, right? but you said it was expensive to call?
@rgarcia Alternatively, we can still use the GraphQL API but avoid the Go annotations - just using JSON directly - see here
👋 @benwaffle @rgarcia Unfortunately there isn't an equivalent REST API for CombinedStatus (CheckRun states + Status states)
Alternatively if you wanted to use purely REST there's the List check suites for a Git reference API, which will get you all the check suites for a specific commit, and that covers checks (including actions). But, it's paginated and a bit slower than using the GraphQL query. You'd still need to call the Statuses API that you are doing today, in combination with the new Checks call.
My vote would be to just use the GraphQL call 👍
Is this PR still needed? Discovering this repo now and looking into using it internally, we don't fear GraphQL and absolutely do need to check for all statuses and checks :) I'm likely needing to fork this repo anyway to support forking a repo where a push fails due to a lack of write permissions.
Thanks!
It's still relevant, but the maintainers would like it to be written using the REST API instead. Personally I've just been opening and merging all the PRs manually when green, and that's been good enough for me.