add clang-format action #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Check Clang Format" | |
on: [push, pull_request] | |
jobs: | |
clang-format: | |
name: "Clang Formatter" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
submodules: recursive | |
- name: Paths filter | |
uses: dorny/paths-filter@master | |
id: filter | |
with: | |
filters: | | |
file_changed: | |
- "**/*.cpp" | |
- "**/*.c" | |
- "**/*.h" | |
- "**/*.hpp" | |
- "**/*.cxx" | |
- name: "Format it!" | |
if: ${{ steps.filter.outputs.file_changed == 'true' }} | |
uses: DoozyX/clang-format-lint-action@master | |
id: check_format | |
with: | |
source: "./" | |
clangFormatVersion: 14 | |
inplace: False | |
style: "file" | |
- name: Ignore it! | |
if: ${{ steps.filter.outputs.be_changes == 'false' }} | |
run: echo 'No need to check.' |