Skip to content

Commit 7d1aa72

Browse files
committed
clang-tidy should check changes against the base target branch
1 parent 251ae68 commit 7d1aa72

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

.github/workflows/lint.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,9 @@ jobs:
6464
cd ..
6565
6666
# Run lintrunner on all csrc files exclude benchmark and test folders
67-
this_commit=$(git rev-parse HEAD)
68-
git fetch origin main
69-
git checkout origin/main
70-
head_commit=$(git rev-parse HEAD)
71-
git checkout $this_commit
67+
base_ref="${{ github.base_ref || 'main' }}"
68+
git fetch origin $base_ref
69+
head_commit=$(git rev-parse FETCH_HEAD)
7270
# diff-filter for lower case letter:
7371
# https://github.com/git/git/commit/7f2ea5f0f2fb056314092cce23202096ca70f076
7472
git --no-pager diff --diff-filter=d --name-only $head_commit | grep -e "csrc/.*\.cpp" -e "csrc/.*\.h" | xargs lintrunner --take CLANGTIDY --force-color

0 commit comments

Comments
 (0)