Skip to content

Commit 6d76801

Browse files
committed
Fix clang-tidy linter to handle empty file arrays correctly
When all changed C++ files are excluded by the exclude_files_pattern, the linter was attempting to run clang-tidy with an empty string argument, causing a process error. Changes: - Add a second check after filtering to ensure no empty strings remain in the array - Exit cleanly if no files are found after filtering - This prevents passing empty strings to the linter command Fixes the failing lint job when only excluded files are changed.
1 parent 6336f7f commit 6d76801

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

.github/actions/run-linter/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,10 @@ runs:
4949
fi
5050
echo "Changed files:"
5151
printf '%s\n' "${CHANGED_FILES[@]}"
52+
# Filter out any empty strings that may have been added to the array
53+
CHANGED_FILES=("${CHANGED_FILES[@]}" | grep -v '^$')
54+
if [[ "${#CHANGED_FILES[@]}" -eq 0 ]]; then
55+
echo "No changed cpp files after filtering."
56+
exit 0
57+
fi
5258
printf '%s\n' "${CHANGED_FILES[@]}" | parallel --verbose --jobs "$(nproc)" --plus _=[{#}/{##}] ${{ inputs.lint_program_with_args }} {}

0 commit comments

Comments
 (0)