diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-07-18 13:54:41 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2023-07-18 14:23:37 +0200 |
| commit | fc901f98564134368db3a92fb0644c5afe292f10 (patch) | |
| tree | 7b98fff4dd1cb5df07e2a94b8e3d3533228caacf /.github | |
| parent | 13964c7fca1fe387d502a0044014f276147bc6e6 (diff) | |
ci: add check for no CRLF line endings.
Diffstat (limited to '.github')
| -rwxr-xr-x | .github/ci/crlf.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/.github/ci/crlf.sh b/.github/ci/crlf.sh new file mode 100755 index 000000000..457510407 --- /dev/null +++ b/.github/ci/crlf.sh | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | ## on push branch~=gh-readonly-queue/main/.* | ||
| 3 | ## on pull_request | ||
| 4 | |||
| 5 | set -euo pipefail | ||
| 6 | |||
| 7 | FILES_WITH_CRLF=$(find ! -path "./.git/*" -not -type d | xargs file -N | (grep " CRLF " || true)) | ||
| 8 | |||
| 9 | if [ -z "$FILES_WITH_CRLF" ]; then | ||
| 10 | echo -e "No files with CRLF endings found." | ||
| 11 | exit 0 | ||
| 12 | else | ||
| 13 | NR_FILES=$(echo "$FILES_WITH_CRLF" | wc -l) | ||
| 14 | echo -e "ERROR: Found ${NR_FILES} files with CRLF endings." | ||
| 15 | echo "$FILES_WITH_CRLF" | ||
| 16 | exit "$NR_FILES" | ||
| 17 | fi \ No newline at end of file | ||
