Skip to content

Commit ab3996d

Browse files
authored
Reduce clang-tidy trigger scope (#167)
1 parent f1e24fc commit ab3996d

2 files changed

Lines changed: 3 additions & 24 deletions

File tree

.github/actions/clang-tidy-native/action.yml

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,31 +31,9 @@ runs:
3131
run: |
3232
git config --global --add safe.directory $GITHUB_WORKSPACE
3333
git fetch origin ${{ github.event.pull_request.base.ref }}
34-
35-
# Check if .clang-tidy files were changed
36-
CLANG_TIDY_CHANGED=$(git diff --name-only \
34+
CHANGED_FILES=$(git diff --name-only \
3735
origin/${{ github.event.pull_request.base.ref }}...HEAD \
38-
-- '**/.clang-tidy' || true)
39-
40-
if [ -n "$CLANG_TIDY_CHANGED" ]; then
41-
echo "::notice::.clang-tidy configuration changed, analyzing all source files"
42-
# Find all source files in the repository (excluding specified directories)
43-
CHANGED_FILES=$(find . -name "*.cpp" -o -name "*.hpp" -o -name "*.c" -o -name "*.h")
44-
# Filter out excluded directories
45-
for exclude_dir in ${{ inputs.exclude }}; do
46-
CHANGED_FILES=$(echo "$CHANGED_FILES" | grep -v "^./${exclude_dir}/" || true)
47-
done
48-
else
49-
# Only analyze changed source files
50-
CHANGED_FILES=$(git diff --name-only \
51-
origin/${{ github.event.pull_request.base.ref }}...HEAD \
52-
-- '*.cpp' '*.hpp' '*.c' '*.h')
53-
# Filter out excluded directories
54-
for exclude_dir in ${{ inputs.exclude }}; do
55-
CHANGED_FILES=$(echo "$CHANGED_FILES" | grep -v "^${exclude_dir}/" || true)
56-
done
57-
fi
58-
36+
-- '*.cpp' '*.hpp' '*.c' '*.h' | grep -v '^${{ inputs.exclude }}/' || true)
5937
echo "changed_files<<EOF" >> $GITHUB_OUTPUT
6038
echo "$CHANGED_FILES" >> $GITHUB_OUTPUT
6139
echo "EOF" >> $GITHUB_OUTPUT

.github/workflows/static-analysis-pr.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- '**/CMakeLists.txt'
1111
- '**/*.cmake'
1212
- '**/.clang-tidy'
13+
- '.github/actions/clang-tidy-native/action.yml'
1314
- '.github/workflows/static-analysis-pr.yml'
1415

1516
concurrency:

0 commit comments

Comments
 (0)