Fail the analyze action when some language fails to run the queries #271
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.
In analyze:runQueries we are warding the codeql call with a try, and if we catch something we set an error message, update the status report with the failed language and returning it. Just after that in runAnalyze we are always doing the upload without considering if the runQueries failed or not. This caused that we were uploading partial results, and that doesn't make sense. Partial results would mean that alerts could disappear without being fixed.
The reason why the action is not marked as failed is because this is only done at the topmost catch, in
analyze-action, and we are not bubbling up the exception, just catching it and setting the status report.As we want to keep the status report, I've created an
Errorsubclass where we can attach it and submit it as a failed status report.Here is a run with the old behaviour: https://github.com/dsp-testing/daverlo-test-fail-analyze/actions/runs/321647298
The job is green but it has an error saying the analysis failed.
Here is the same repo but it run with this branch: https://github.com/dsp-testing/daverlo-test-fail-analyze/actions/runs/321654493
Merge / deployment checklist