From: Habu Date: Wed, 12 Jun 2024 10:33:12 +0000 (+0900) Subject: [Chore] 改行コードがLFであることをチェックする X-Git-Tag: 3.0.1.15-Beta~2^2~1 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=a39375604b1f50bc1d5267dfa5f2cff899fa66fa;p=hengbandforosx%2Fhengbandosx.git [Chore] 改行コードがLFであることをチェックする プルリクエストのCIによるチェックで、すべてのテキストファイルの改行 コードがCRLFではなくLFであることをチェックする。 ただし、./VisualStudio/ 以下のファイルは Visual Studio が自動的にCRLFで 上書き保存するので、混乱を避けるためチェックから除外する。 --- diff --git a/.github/scripts/check-newline.sh b/.github/scripts/check-newline.sh new file mode 100644 index 000000000..05107c962 --- /dev/null +++ b/.github/scripts/check-newline.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# ./VisualStudio/ 以下のファイルはVisual StudioがCRLFで上書きするため除外 +CHECK_FILES=$(find . -type f -not -path './.git/*' -and -not -path './VisualStudio/*' -and -not -name \*.wav -and -not -name \*.mp3) + +STATUS=0 + +for file in $CHECK_FILES; do + file $file | grep "CRLF" >/dev/null + if [ $? -eq 0 ]; then + echo "$file: newline is CRLF." + STATUS=1 + fi +done + +exit $STATUS diff --git a/.github/workflows/pull-request-status-check.yml b/.github/workflows/pull-request-status-check.yml index b148e047c..eaf42f5e6 100644 --- a/.github/workflows/pull-request-status-check.yml +++ b/.github/workflows/pull-request-status-check.yml @@ -15,6 +15,13 @@ jobs: - uses: actions/checkout@v3 - run: sh ./.github/scripts/check-bom.sh + check_newline: + name: Check the newline of files + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: sh ./.github/scripts/check-newline.sh + check_format: name: Check the format of the source files runs-on: ubuntu-latest