fix(github): Don't fail when there are queued check suites#117
Conversation
When the check suites are queued but the check runs haven't started yet, Craft immediately fails. With this patch, it also checks the Check Suites API to see if there are any pending check suites. Fixes #111.
jan-auer
left a comment
There was a problem hiding this comment.
LGTM. I'm a bit curious how the suites are registered so much earlier than the runs. My guess is that #111 can still happen, it's maybe just less likely. Would it make sense add a guard that waits for some time if there are no check suites?
@BYK based on this patch, could we get rid of the Check Runs API and use the status and conclusion of the suites instead?
| suite => | ||
| // Need the any cast as octokit lacks this prop in its types | ||
| (suite as any).latest_check_runs_count > 0 && | ||
| suite.status === 'queued' |
There was a problem hiding this comment.
nit: This is done in two places and might qualify for a small helper function given the comment.
| * Gets revision checks from GitHub Check runs API | ||
| * | ||
| * API docs: | ||
| * https://developer.github.com/v3/checks/suites/#list-check-suites-for-a-git-reference |
There was a problem hiding this comment.
Note that this requires the checks:read permission. I believe, we already require the generic read permission, so this shouldn't pose as an issue.
Co-authored-by: Jan Michael Auer <mail@jauer.org> Co-authored-by: Anton Ovchinnikov <anton@tonyo.info>
Possibly, I need to dig and debug more. Btw. I finally found the docs for
It indeed sounds like what we need/want here. |
This should be obsolete by getsentry/craft#117.
getsentry/craft#117 is merged and released and seems to work so no need for this `sleep 10` anymore.
getsentry/craft#117 is merged and released and seems to work so no need for this `sleep 10` anymore.
getsentry/craft#117 is merged and released and seems to work so no need for this `sleep 10` anymore.
Turns out getsentry/craft#117 did not fix the issue fully.
Turns out getsentry/craft#117 did not fix the issue fully.
When the check suites are queued but the check runs haven't started yet, Craft immediately fails. With this patch, it also checks the Check Suites API to see if there are any pending check suites.
Fixes #111.