Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/diegoferigo/gh-action-clang-format
Run clang-format on your sources to validate the style.
https://github.com/diegoferigo/gh-action-clang-format
actions clang clang-format container docker format formatter github github-actions style stylelint
Last synced: about 1 month ago
JSON representation
Run clang-format on your sources to validate the style.
- Host: GitHub
- URL: https://github.com/diegoferigo/gh-action-clang-format
- Owner: diegoferigo
- License: mit
- Created: 2021-07-16T14:54:45.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-08-25T10:19:38.000Z (over 3 years ago)
- Last Synced: 2024-10-16T22:19:55.262Z (3 months ago)
- Topics: actions, clang, clang-format, container, docker, format, formatter, github, github-actions, style, stylelint
- Language: Shell
- Homepage:
- Size: 12.7 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# GitHub Action: clang-format
**This action runs `clang-format` on your sources and validates the style.**
The style can either be one of the [default profiles][style_options],
or a customized `.clang-format` file part of the repository.[style_options]: https://clang.llvm.org/docs/ClangFormatStyleOptions.html#configurable-format-style-options
## Getting started
Here below a simple example to validate pull request against the `Google` style:
```yaml
name: C++ Styleon:
pull_request:
workflow_dispatch:jobs:
clang-format-check:
name: "Test C++ style"
runs-on: ubuntu-lateststeps:
- name: "🔀 Checkout repository"
uses: actions/checkout@v2- name: "⬇️️ Install dependencies"
run: sudo apt-get install -y --no-install-recommends colordiff- name: "📝 Format C++"
uses: diegoferigo/gh-action-clang-format@main
id: format
with:
style: Google- name: "🔍️ Inspect style diff"
if: failure()
run: printf "${{ steps.format.outputs.diff }}" | colordiff
```Have a look to [`ci.yml`][ci.yml] for a practical example,
and refer to the input and output details below.[ci.yml]: .github/workflows/ci.yml
## Inputs
| Name | Required | Default value | Description |
| ---- | -------- | ------------- | ----------- |
| `version` | No | `13` | the clang-format version to run |
| `directory` | No | `/github/workspace` | the directory where to find the files to format |
| `pattern` | No | `*.h *.hh *.cpp *.cc` | string defining the sources matching pattern |
| `style` | Yes | `-` | the clang-format style to apply |
| `fallback` | No | `none` | the fallback clang-format style to apply |
| `fail_on_error` | No | `1` | make the step fail in case of unformatted sources |## Outputs
| Name | Description |
| ---- | ----------- |
| `diff` | The diff after the style formatting |## Contributing
Pull requests are welcome.
For major changes, please open an issue first to discuss what you would like to change.## License
[MIT](https://choosealicense.com/licenses/mit/)