diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2c16136..996e89b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,21 +42,6 @@ jobs: # GitHub Pages directory path ghpagesdir: ./docs - Formatting: - name: Clang Format - runs-on: ubuntu-latest - strategy: - matrix: - path: - - 'src' - - 'examples' - steps: - - uses: actions/checkout@v3 - - name: Run clang-format style check for C/C++/Protobuf programs. - uses: jidicula/clang-format-action@v4.11.0 - with: - clang-format-version: '14' - check-path: ${{ matrix.path }} Linting: name: Shellcheck diff --git a/.github/workflows/formatting-check.yml b/.github/workflows/formatting-check.yml new file mode 100644 index 0000000..669b93c --- /dev/null +++ b/.github/workflows/formatting-check.yml @@ -0,0 +1,23 @@ +name: Formatting check + +on: + pull_request: + types: + - "opened" + - "reopened" + - "synchronize" + - "labeled" + - "unlabeled" + +jobs: + formatting_check: + name: Formatting Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: clang-format style check + run: | + git clang-format-14 --diff -q origin/main | tee format_diff.txt + if [ -s format_diff.txt ]; then exit 1; fi