From ccb45a803eaddb0d86ce5c906e8f1d8bb41b652a Mon Sep 17 00:00:00 2001 From: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> Date: Sun, 6 Nov 2022 16:55:50 +0900 Subject: [PATCH] fix(clang-tidy): mark the workflow as failed if the fixes.yaml file exists (#192) Signed-off-by: Kenji Miyake Signed-off-by: Kenji Miyake --- clang-tidy/action.yaml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/clang-tidy/action.yaml b/clang-tidy/action.yaml index 02a8f260..8e00321c 100644 --- a/clang-tidy/action.yaml +++ b/clang-tidy/action.yaml @@ -116,18 +116,26 @@ runs: run: | mkdir /tmp/clang-tidy-result clang-tidy -p build/ -export-fixes /tmp/clang-tidy-result/fixes.yaml ${{ steps.get-target-files.outputs.target-files }} || true - shell: bash - - - name: Save PR metadata - if: ${{ steps.get-target-files.outputs.target-files != '' }} - run: | echo "${{ github.event.number }}" > /tmp/clang-tidy-result/pr-id.txt echo "${{ github.event.pull_request.head.repo.full_name }}" > /tmp/clang-tidy-result/pr-head-repo.txt echo "${{ github.event.pull_request.head.ref }}" > /tmp/clang-tidy-result/pr-head-ref.txt shell: bash - - uses: actions/upload-artifact@v3 - if: ${{ steps.get-target-files.outputs.target-files != '' }} + - name: Check if the fixes.yaml file exists + id: check-fixes-yaml-existence + uses: autowarefoundation/autoware-github-actions/check-file-existence@v1 + with: + files: /tmp/clang-tidy-result/fixes.yaml + + - name: Upload artifacts + if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }} + uses: actions/upload-artifact@v3 with: name: clang-tidy-result path: /tmp/clang-tidy-result/ + + - name: Mark the workflow as failed if the fixes.yaml file exists + if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }} + run: | + exit 1 + shell: bash