add git actions #5
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Check Line Endings | |
| on: | |
| pull_request: | |
| paths: | |
| - '**/*.sh' | |
| push: | |
| paths: | |
| - '**/*.sh' | |
| jobs: | |
| check_line_endings: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Find shell scripts with CRLF line endings | |
| shell: bash | |
| run: | | |
| echo "🔍 Checking for CRLF endings in shell scripts..." | |
| # Szukamy plików .sh zawierających CRLF | |
| mapfile -t crlf_files < <(find . -type f -name "*.sh" -exec grep -Il $'\r' {} +) | |
| if (( ${#crlf_files[@]} > 0 )); then | |
| echo "" | |
| echo "🚫 The following .sh files contain CRLF (Windows-style) line endings:" | |
| for file in "${crlf_files[@]}"; do | |
| echo " • $file" | |
| done | |
| echo "" | |
| echo "💡 Please convert them to LF endings using 'dos2unix' or 'shellman line_endings'." | |
| exit 1 | |
| else | |
| echo "✅ All .sh files use correct LF line endings." | |
| fi |