From 4993f6628825db1a38a4f58a942934a6906b863d Mon Sep 17 00:00:00 2001 From: GOB Date: Tue, 20 Aug 2024 23:28:48 +0900 Subject: [PATCH] Change execute conditions --- .github/workflows/clang-format-check.yml | 54 ++++++++++++++++++------ 1 file changed, 41 insertions(+), 13 deletions(-) diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml index c15883b..1825582 100644 --- a/.github/workflows/clang-format-check.yml +++ b/.github/workflows/clang-format-check.yml @@ -1,5 +1,27 @@ name: clang-format Check -on: [push, pull_request] + +env: + INCLUDE_REGEX: ^.*\.((((c|C)(c|pp|xx|\+\+)?$)|((h|H)h?(pp|xx|\+\+)?$))|(inl|ino|pde|proto|cu))$ + +on: + push: + paths: + - '**.ino' + - '**.cpp' + - '**.hpp' + - '**.h' + - '**.c' + - '**.inl' + - '**clang-format-check.yml' + pull_request: + - '**.ino' + - '**.cpp' + - '**.hpp' + - '**.h' + - '**.c' + - '**.inl' + - '**clang-format-check.yml' + jobs: formatting-check: name: Formatting Check @@ -7,17 +29,23 @@ jobs: strategy: matrix: path: + #- check: './' # path to include + # exclude: '' # path to exclude - check: 'src' - exclude: '' - - check: 'examples' - exclude: '' - - check: 'test' - exclude: '' + # exclude: '(Fonts)' # Exclude file paths containing "Fonts" + # - check: 'examples' + # exclude: '' + steps: - - uses: actions/checkout@v3.1.0 - - name: Run clang-format style check for C/C++/Protobuf programs. - uses: jidicula/clang-format-action@v4.9.0 - with: - clang-format-version: '13' - check-path: ${{ matrix.path['check'] }} - exclude-regex: ${{ matrix.path['exclude'] }} + - name: Checkout # When pull_request is used, include it in the checkout https://zenn.dev/hkusu/articles/c731862051438b + uses: actions/checkout@v3.1.0 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Run clang-format style check for C/C++/Protobuf programs. + uses: jidicula/clang-format-action@v4.10.2 # Using include-regex 10.x or later + with: + clang-format-version: '13' + check-path: ${{ matrix.path['check'] }} + exclude-regex: ${{ matrix.path['exclude'] }} + include-regex: ${{ env.INCLUDE_REGEX }}