Skip to content

add git actions

add git actions #9

name: Check Shell Script Line Endings
on:
push:
pull_request:
jobs:
check_crlf_in_sh:
name: Check for CRLF in .sh files
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
unix-newlines: false
- name: Scan all *.sh files for CRLF endings
shell: bash
run: |
echo "🔍 Scanning all *.sh files for CRLF endings..."
mapfile -t all_sh_files < <(find . -type f -name "*.sh")
bad_files=()
for file in "${all_sh_files[@]}"; do
if grep -q $'\r' "$file"; then
bad_files+=("$file")
fi
done
if (( ${#bad_files[@]} > 0 )); then
echo "🚫 Found ${#bad_files[@]} shell script(s) with CRLF endings:"
for f in "${bad_files[@]}"; do
echo " • $f"
done
echo ""
echo "💡 Please convert these files to LF using 'dos2unix <file>' or 'shellman line_endings --file <file> --to lf'"
exit 1
else
echo "✅ All .sh files use proper LF line endings."
fi