-
Notifications
You must be signed in to change notification settings - Fork 49
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
Clang format action should probably only touch changed files #128
Comments
I'd like to look into this issue. |
The PlanMy plan for this was to use another Marketplace job that could retrieve a list of changed files and then pass that list to the clang-format action. The Good NewsThe good news is I've been able to use tj-actions/changed-files to make and pass a list of changed files to the clang-format action. Here's a successful run of the updated workflow working on CPP source files (*.cpp, *.h) One version of the updated workflow (targeting only CPP feature code). The Bad NewsThe clang-format action doesn't play nice with filepaths containing whitespace and will fail if these are passed. I tried extended the changed-files job to also search for changed shader files (
Here's an example of what it looks like, from a different workflow run and workflow version: Notice that the CPP source files (with no spaces in their filepaths) are successfully passed to the clang-format job, but the other paths are broken up like below:
A Possible Solution - Truncate FilepathsI've tried modifying the updated workflow to process the filepaths retrieved from the changed-files step, such as by wrapping the filepaths in double quotes, single quotes, or escaping the whitespaces. In all cases, the clang-format action will incorrectly parse the list of filepaths, and the workflow file becomes an eyesore. Truncating all directories with whitespaces (like |
This can't be an unsolved problem. Have you checked clang-format to see if they've seen this issue? What about piping the list of names into a temporary text file and then ingesting that for clang-format? The issue with changing the path conventions is I believe some of the code is reliant on parsing the feature path name. I'd try to avoid modifying paths unless it's absolutely not possible. |
I agree, I'd rather modify just the workflow file. I've looked at alternatives for DoozyX/clang-format-lint, specifically jidicula/clang-format-action that seems to have solved the filepath parsing issue. However, they don't support the I think this an issue with how DoozyX/clang-format-lint-action parses the filepaths. I'm actually looking into submitting a PR to DoozyX/clang-format-lint-action for this. This might take a few days. |
Just a short update. After my experiments with the workflow a couple weeks back, I read through the clang-format-lint repo I found the Pull Request that added multiple-file support. In it, the PR contributor noted that the feature doesn't support filepaths with whitespaces. In the past couple of weeks, I extended the GitHub Action to support filepaths with whitespaces, and recently submitted a Pull Request to the clang-format-lint repo with my modifications. The PR still needs to be reviewed and approved by the maintainers, but if my additions are approved, then I can get my enhancements to the clang-format Linter action to work with any changed file inside directories with whitespaces. Until then I hope to work with the maintainers to add this feature. |
Awesome. Thanks for the investigation and work. |
Apologies for the radio silence. I've been able to work on this again during my mid-semester break, and after some experimentation, I've got the clang-format action working on only modified source files (C++ source code and shader files). I'll have a PR ready tomorrow. |
No worries. Thanks for reaching out. |
Can this be changed to not be just the previous commit but all the commit in the last push? See this branch for example:
For this case the |
https://github.com/doodlum/skyrim-community-shaders/blob/dev/.github/workflows/clang_format.yml
The text was updated successfully, but these errors were encountered: