CI: Post pre-commit fixes as suggestions #6809
Open
+74
−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.
In order to simplify updating clang-format versions, I want to remove the clang-format workflow, and only use pre-commit for handling clang-format.
This means that the pre-commit run here should become a required check, and the clang-format workflow should not be a required check anymore. After merging this, these two changes should be made. cc @wenzeslaus
Until clang-format is removed, duplicate suggestions might be posted for clang-format fixes (one from clang-format workflow, and one from pre-commit). If you prefer, I can include the removal here, but the changes to the required checks must be done right before merging this (otherwise the existing and required clang-format check won't report a success).
To make this possible, I added a new tool source and new workflow source for posting PR suggestions. It is not intended to remove the older sources yet, as it allows un-updated PRs and branches to still have the suggestions posted.
I also needed to use prek instead of pre-commit (I've been using it since fall). https://github.com/j178/prek https://prek.j178.dev/ It is a rust equivalent of pre-commit, similar to ruff/uv, and installs way faster, and is faster in some tasks. It allows to skip hooks, rather than including hooks. That allows for removing running hooks that already post suggestions or handled in other workflows, collect the changed files for suggestions, and then run all pre-commit hooks without posting suggestions.
PR #6808 is intended to add fixes from an additional tool.
I also had to remove the created core_modules_with_last_commit.json file, as that changed file was creating problems when checking for changed files (to upload for suggestions). So, before deleting it, I uploaded it as an artifact.