blob: 41a31cc66501eb3f28d4dc237dcb900408ffc803 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)$"
|