Lint C/C++ code using clang-format.
Based on https://github.com/muttleyxd/clang-tools-static-binaries prebuilt binaries.
- Runs
clang-formaton your codebase - Supports custom configuration via
.clang-format - Supports
.gitignoreand.clang-format-ignorefiles - Easy integration with GitHub Workflows
Add the following to your workflow YAML:
- uses: nicelabs/clang-format-action@v1Defined in action.yaml.
Place your .clang-format file in the repository root to customize formatting rules.
See https://clang.llvm.org/docs/ClangFormatStyleOptions.html
- Q: How to configure which version of clang-format was used?
A: Useversionoption. e.g.version: 20. - Q: I want to format the code directly instead of raise a warning.
A: Usedry-run: false. - Q: I want to exclude some files from format operation.
A: Add them into.clang-format-ignorefile. - Q: I want format a subdirectory only.
A: Usepathoption. e.g.path: src.