GitHub Actions Checks: Submit the checks in batches #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is needed because GitHub Actions Checks API limits the number of annotations to a maximum of 50 per API request. To create more than 50 annotations, you have to make multiple requests to the Update a check run endpoint.
https://docs.github.com/en/developers/apps/guides/creating-ci-tests-with-the-checks-api#step-24-collecting-rubocop-errors
Closes #6
Action fails with: Error: Invalid request. No more than 50 items are allowed; 404 were supplied.
More people having this issue (just 2 random repos, but there are more):
Their fixes are similar to mine:
Test steps:
I believe, but I didn't properly test to confirm, that I'm making these Checks update requests in parallel. This means that, if there are 2000 errors, this will make 2000 / 50 = 40 requests at the same time.
I tested this if it will timeout or get rate limited, and it doesn't. It does slow down as it needs to make all those requests. It slows down by approx 1s per 100 annotations (it seems to be able to make 2 requests per second(?), but I'm not sure as I'm supposedly making all of these requests at once?).
I ran this action on a repo with 2207 theme-check issues.
Here are my findings:
There's an undocumented limit of 1000 annotations. I searched GH Actions documentation and couldn't find anything about the upper limit, only 50 annotations limit per request.
I tested with updating Checks in parallel and consecutively.
Running in parallel:
Running consecutively:
Results
There seems to be a race condition when doing Checks update. It always reports 1000 annotations. However, it always reports 1000 different annotations.
I tested this for both "parallel job" and "consecutive job" (code posted above).
It only seems that "parallel job" runs some ~10 seconds faster so I kept that code here in the PR.
In my defense for having a theme with 2000+ errors...YOU'RE WELCOME! (for the great testing material! 😅 )