Skip to content

Commit f9298f6

Browse files
committed
Fix cppcheck skip logic on CI
1 parent 3ffbb2a commit f9298f6

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

.github/workflows/run-ubuntu-checks.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,19 @@ jobs:
135135

136136
steps:
137137
- uses: actions/checkout@v4.2.2
138+
with:
139+
fetch-depth: 0 # fetch full history
138140

139141
- name: Check if any src_c files changed
140142
id: check-changes
143+
continue-on-error: true
141144
run: |
142-
git fetch origin ${{ github.base_ref }} --depth=1 || true
143-
git checkout ${{ github.base_ref }}
144-
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
145+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
146+
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
147+
else
148+
CHANGED_FILES=$(git diff --name-only HEAD^1...HEAD)
149+
fi
150+
echo "Changed files: $CHANGED_FILES"
145151
echo "$CHANGED_FILES" | grep '^src_c/' || echo "skip=true" >> "$GITHUB_OUTPUT"
146152
147153
- name: Install cppcheck

0 commit comments

Comments
 (0)