Skip to content

Commit

Permalink
Restructured ci check formats
Browse files Browse the repository at this point in the history
  • Loading branch information
Rd4dev committed Sep 5, 2024
1 parent 0de63b0 commit 830c30d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/static_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ jobs:
if: ${{ !cancelled() }}
run: |
bash /home/runner/work/oppia-android/oppia-android/scripts/pre-commit.sh
echo "No binary files found"
echo "No binary files found in commit"
echo "BINARY FILES CHECK PASSED"
- name: Regex Patterns Validation Check
Expand Down
15 changes: 4 additions & 11 deletions scripts/pre-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,15 @@ function checkForBinaries() {
# Iterate over all files (both staged and changed)
for file in $all_files; do
if [ -f "$file" ] && file --mime "$file" | grep -q 'binary'; then
binaryFiles+="${file}\n"
((binaryFilesCount++))
printf "\033[33m%s\033[0m\n" "$file"
printf "\n\033[33m%s\033[0m" "$file"
fi
done

if [[ -n "${binaryFiles}" && "${binaryFilesCount}" -gt 0 ]]; then
printf "\nPlease remove the binary file(s):\n\n"
while IFS= read -r line; do
printf "\033[33m%b\033[0m\n" "$line"
printf ""
done <<< "$binaryFiles"
printf "\nBINARY FILES CHECK FAILED\n"
if [[ "${binaryFilesCount}" -gt 0 ]]; then
printf "\n\nPlease remove the %d detected binary file(s)." "$binaryFilesCount"
printf "\nBINARY FILES CHECK FAILED"
exit 1
else
printf "\nBINARY FILES CHECK PASSED\n"
fi
}

Expand Down

0 comments on commit 830c30d

Please sign in to comment.