Merge pull request #1745 from ZLMediaKit/feature/check-utf8-bom

Add workflow action to validate BOM
This commit is contained in:
Xiaofeng Wang 2022-06-25 11:05:08 +08:00 committed by GitHub
commit 62569db9a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

27
.github/workflows/style.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: style check
on: [pull_request]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# with all history
fetch-depth: 0
- name: Validate BOM
run: |
ret=0
for i in $(git diff --name-only origin/${GITHUB_BASE_REF}...${GITHUB_SHA}); do
if [ -f ${i} ]; then
case ${i} in
*.c|*.cc|*.cpp|*.h)
if file ${i} | grep -qv BOM; then
echo "Missing BOM in ${i}" && ret=1;
fi
;;
esac
fi
done
exit ${ret}