aboutsummaryrefslogtreecommitdiff
path: root/.github/ci/crlf.sh
blob: 457510407f4fec9316a0f6e16c496b8ce15e7f43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
## on push branch~=gh-readonly-queue/main/.*
## on pull_request

set -euo pipefail

FILES_WITH_CRLF=$(find  ! -path "./.git/*" -not -type d | xargs file -N | (grep " CRLF " || true))

if [ -z "$FILES_WITH_CRLF" ]; then
  echo -e "No files with CRLF endings found."
  exit 0
else
  NR_FILES=$(echo "$FILES_WITH_CRLF" | wc -l)
  echo -e "ERROR: Found ${NR_FILES} files with CRLF endings."
  echo "$FILES_WITH_CRLF"
  exit "$NR_FILES"
fi