This is an automated email from the ASF dual-hosted git repository.

yuanzhou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git


The following commit(s) were added to refs/heads/main by this push:
     new 9c243baf7e [CI] Fix clang-tidy workflow (#11507)
9c243baf7e is described below

commit 9c243baf7eebeee7b2d030f96062df7d158e5aa9
Author: PHILO-HE <[email protected]>
AuthorDate: Thu Jan 29 03:44:01 2026 +0800

    [CI] Fix clang-tidy workflow (#11507)
    
    Fix CI failure: 
https://github.com/apache/incubator-gluten/actions/runs/21365107647/job/61494585208
    
    The C++ code changes have been made by PR, but not detected in the workflow.
    When need to skip, the artifact download does skip, but the later step 
depends on it doesn't skip.
---
 .github/workflows/cpp_clang_tidy.yml | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/.github/workflows/cpp_clang_tidy.yml 
b/.github/workflows/cpp_clang_tidy.yml
index d1ba81e73c..b6fff9e776 100644
--- a/.github/workflows/cpp_clang_tidy.yml
+++ b/.github/workflows/cpp_clang_tidy.yml
@@ -38,21 +38,16 @@ jobs:
         with:
           ref: ${{ github.event.workflow_run.head_sha }}
           fetch-depth: 0
-      - name: Detect CPP file changes
+      - name: Detect C++ file changes
         id: filter
         run: |
-          BASE_SHA=$(python3 -c "
-          import json, os
-          with open(os.environ['GITHUB_EVENT_PATH']) as f:
-              event = json.load(f)
-              wr = event.get('workflow_run', {})
-              prs = wr.get('pull_requests', [])
-              if prs:
-                  print(prs[0]['base']['sha'])
-              else:
-                  print(wr.get('before', ''))
-          ")
           HEAD_SHA="${{ github.event.workflow_run.head_sha }}"
+          git remote -v && git fetch origin main:main
+          # Finds the common ancestor for PR targeting the main branch only.
+          # We may need to update the base branch if PR is not targeting the 
main branch.
+          BASE_SHA=$(git merge-base main $HEAD_SHA)
+          echo "BASE_SHA: $BASE_SHA"
+          echo "HEAD_SHA: $HEAD_SHA"
           if git diff --name-only $BASE_SHA $HEAD_SHA | grep -E 
'^cpp/.*\.(cc|h)$'; then
             echo "cpp_changed=true" >> $GITHUB_OUTPUT
           else
@@ -71,6 +66,7 @@ jobs:
           search_artifacts: true
           if_no_artifact_found: fail
       - name: Check Clang Tidy
+        if: steps.filter.outputs.cpp_changed == 'true'
         run: |
           pip3 install regex
           yum install glibc-devel glibc-headers


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to