Skip to content

Commit

Permalink
Add check if git diff succeeded.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rot127 committed Apr 30, 2024
1 parent 3dd102d commit 9e0e1f2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
analyze:
runs-on: ubuntu-latest

name: Install clang-tidy
name: clang-tidy
steps:
- uses: actions/checkout@v3
- name: Install clang-tidy
Expand Down
20 changes: 18 additions & 2 deletions run-clang-tidy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,32 @@ top_level=$(git rev-parse --show-toplevel)

echo "\n\n###### REPORT\n\n"

for modified in $(git diff --name-only origin/next); do
git pull origin next
changed_files=$(git diff --name-only origin/next)
if [ $? -ne 0 ]; then
echo "Failed to get changed files."
exit 1
fi

for modified in changed_files; do
files_changed=1
full_path="$top_level/$modified"
if grep -q "$full_path" $tmp; then
echo "$full_path as warnings. Please fix them."
needs_fixes=1
fi
done

if [ -z $files_changed ]; then
echo "No files changed."
exit 0
fi

if [ -z $needs_fixes ]; then
echo "All good"
echo "None of the changed files has clang-tidy warnings."
exit 0
fi

echo "Some changed files have clang-tidy warnings. Please fix them. Or, if completely unrelated, let us know."

exit 1

0 comments on commit 9e0e1f2

Please sign in to comment.