From 16f62b9167f1c577e51dbaf00470bdac22d84aab Mon Sep 17 00:00:00 2001 From: Kotaro Yoshimoto Date: Mon, 24 Jun 2024 16:19:49 +0900 Subject: [PATCH] chore(ci): change way to modified files in clang-tidy-differential (#7639) * chore(ci): fetch full depth in clang-tidy-differential Signed-off-by: Kotaro Yoshimoto * chore(ci): use raw git to get modified files Signed-off-by: Kotaro Yoshimoto * chore(ci): fix deprecated GitHub actions variable operation Signed-off-by: Kotaro Yoshimoto * chore(ci): delete unnecessary steps Signed-off-by: Kotaro Yoshimoto * refactor(ci): unite multiple command line into one line Signed-off-by: Kotaro Yoshimoto --------- Signed-off-by: Kotaro Yoshimoto Signed-off-by: Simon Eisenmann --- .github/workflows/clang-tidy-differential.yaml | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/.github/workflows/clang-tidy-differential.yaml b/.github/workflows/clang-tidy-differential.yaml index a59287a6d9b37..e2e4fc478e0ee 100644 --- a/.github/workflows/clang-tidy-differential.yaml +++ b/.github/workflows/clang-tidy-differential.yaml @@ -20,14 +20,10 @@ jobs: runs-on: ubuntu-latest container: ghcr.io/autowarefoundation/autoware:latest-prebuilt-cuda steps: - - name: Set PR fetch depth - run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}" - - name: Checkout PR branch and all PR commits uses: actions/checkout@v4 with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: ${{ env.PR_FETCH_DEPTH }} + fetch-depth: 0 - name: Show disk space before the tasks run: df -h @@ -41,19 +37,17 @@ jobs: - name: Get modified files id: get-modified-files - uses: tj-actions/changed-files@v42 - with: - files: | - **/*.cpp - **/*.hpp + run: | + echo "changed_files=$(git diff --name-only "origin/${{ github.base_ref }}"...HEAD | grep -E '\.(cpp|hpp)$' || true)" >> $GITHUB_OUTPUT + shell: bash - name: Run clang-tidy - if: ${{ steps.get-modified-files.outputs.all_changed_files != '' }} + if: ${{ steps.get-modified-files.outputs.changed_files != '' }} uses: autowarefoundation/autoware-github-actions/clang-tidy@v1 with: rosdistro: humble target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }} - target-files: ${{ steps.get-modified-files.outputs.all_changed_files }} + target-files: ${{ steps.get-modified-files.outputs.changed_files }} clang-tidy-config-url: https://raw.githubusercontent.com/autowarefoundation/autoware/main/.clang-tidy build-depends-repos: build_depends.repos