File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Check Line Endings
2+
3+ on :
4+ pull_request :
5+ push :
6+ branches :
7+ - master
8+
9+ jobs :
10+ check-line-endings :
11+ name : Enforce .gitattributes line endings
12+ runs-on : ubuntu-latest
13+ steps :
14+ - uses : actions/checkout@v6
15+
16+ - name : Check for line ending violations
17+ run : |
18+ # Re-normalize all files according to .gitattributes
19+ git add --renormalize .
20+
21+ # Check if renormalization changed anything
22+ if git diff --cached --name-only | grep -q .; then
23+ echo "::error::The following files have line endings that don't match .gitattributes settings:"
24+ git diff --cached --name-only
25+ echo ""
26+ echo "To fix, run:"
27+ echo " git add --renormalize ."
28+ echo " git commit -m 'Normalize line endings'"
29+ exit 1
30+ fi
31+
32+ echo "All files have correct line endings."
You can’t perform that action at this time.
0 commit comments