Skip to content

Commit ba78b18

Browse files
author
Jakub Marciniak
committed
version 4
1 parent e0d10df commit ba78b18

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

.github/workflows/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.sh text eol=crlf

.github/workflows/check-line-endings.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
name: Check Shell Script Line Endings
22

33
on:
4-
push:
54
pull_request:
5+
push:
66

77
jobs:
88
check_crlf_in_sh:
99
name: Check for CRLF in .sh files
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: Checkout code
12+
- name: Checkout code (with original line endings)
1313
uses: actions/checkout@v3
1414
with:
15-
unix-newlines: false
15+
fetch-depth: 0
16+
17+
- name: Create .gitattributes to enforce LF
18+
run: |
19+
echo "*.sh text eol=lf" > .gitattributes
1620
17-
- name: Scan all *.sh files for CRLF endings
21+
- name: Check for CRLF in .sh files
1822
shell: bash
1923
run: |
2024
echo "🔍 Scanning all *.sh files for CRLF endings..."
@@ -35,8 +39,8 @@ jobs:
3539
echo " • $f"
3640
done
3741
echo ""
38-
echo "💡 Please convert these files to LF using 'dos2unix <file>' or 'shellman line_endings --file <file> --to lf'"
42+
echo "💡 Convert them using: dos2unix <file> or shellman line_endings --file <file> --to lf"
3943
exit 1
4044
else
41-
echo "✅ All .sh files use proper LF line endings."
45+
echo "✅ All .sh files use proper LF endings."
4246
fi

0 commit comments

Comments
 (0)