-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[wip] Add a workflow to run clang-format and push back the changes #2
base: main
Are you sure you want to change the base?
Conversation
Is there a reason to have a separate python script that delegates the files to |
IIRC mainly to be able to explicitly pick a clang-format version as different versions have slight differences in formatting (even with the same .clang-format config). Additionally, this is probably modeled after the Having said that, if there is a way to remove all or most of that, I am all for it. |
I didn't notice that the repos use a custom local hook for clang, which is only proposing formatting changes and not fixing them in-place. I had probably a bit more common workflow in mind, where the hook is actually doing in-place fixing and then a CI 'format' action is doing |
I did some digging to see why we had this special hook, and I think there are two reasons. Easily possible that either of them is mainly historical at this point.
Anyhow, long story short: Everything that simplifies the setup is good and I am more than happy to go in that direction. |
I created a very small example repository to demonstrate how this could work with just Example PR that demonstrates autofixing. The
According to 'pre-commit' devs the recommended way to run 'pre-commit' hooks in CI jobs is their 3rd party service 'pre-commit.ci' or their lite action that require installing a github application on a repo. I'm not sure if it's really worth |
This is a working draft for a workflow that runs
clang-format -i
and then pushes back the fixes on a PR when prompted via/fix-style
in a comment of the PR.This is all "handrolled", there are actions that could be used to achieve the same
Depending on how much control we want to have over the environment in which we run this we could probably replace quite a bit of this with those. In the end we mainly need to be consistent with what we run in the
pre-commit
workflow in the repository.