From 5344847edaf422d496cdac11c94d5814f3cf2ed2 Mon Sep 17 00:00:00 2001 From: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Date: Tue, 22 Feb 2022 18:07:37 +0100 Subject: feat: encoding CI --- .github/workflows/encoding-check.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/encoding-check.yml (limited to '.github/workflows') diff --git a/.github/workflows/encoding-check.yml b/.github/workflows/encoding-check.yml new file mode 100644 index 0000000..41a31cc --- /dev/null +++ b/.github/workflows/encoding-check.yml @@ -0,0 +1,24 @@ +# Credit https://github.com/2DegreesInvesting/resources/issues/53 + +name: check file encodings in PR +on: [pull_request] +jobs: + file-encoding: + name: file encooding check + runs-on: ubuntu-latest + + steps: + - name: run the checkout action + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: list all changed files + run: | + files=$(git diff --name-only origin/$GITHUB_BASE_REF...${{ github.sha }}) + IFS=$'\n'; files=($files); unset IFS; # split the string into an array + file --mime "${files[@]}" + - name: list all changed files with the wrong encoding + run: | + files=$(git diff --name-only origin/$GITHUB_BASE_REF...${{ github.sha }}) + IFS=$'\n'; files=($files); unset IFS; # split the string into an array + ! file --mime "${files[@]}" | grep -v "charset=utf-8\| (No such file or directory)$" -- cgit