-
Notifications
You must be signed in to change notification settings - Fork 46
43 lines (38 loc) · 1.53 KB
/
check_bom.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: BOM Check
on:
push:
pull_request:
jobs:
bom-check:
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- name: UTF-8 BOM
run: |
grep -oarlE -m 1 --include="*.c" --include="*.h" --include="*.rst" --include="*.txt" --include="*.mk" --include="*.py" --include="*.cmake" --include="Makefile" $'\xEF\xBB\xBF' . | while read -r line; do
a=$(head -c 3 "$line")
if [ "${a}" = $'\xEF\xBB\xBF' ]; then
echo "${line}" && exit 1
fi
done
- name: UTF-16LE BOM
run: |
grep -oarlE -m 1 --include="*.c" --include="*.h" --include="*.rst" --include="*.txt" --include="*.mk" --include="*.py" --include="*.cmake" --include="Makefile" $'\xFF\xFE' . | while read -r line; do
a=$(head -c 3 "$line")
if [ "${a}" = $'\xFF\xFE' ]; then
echo "${line}" && exit 1
fi
done
- name: UTF-16BE BOM
run: |
grep -oarlE -m 1 --include="*.c" --include="*.h" --include="*.rst" --include="*.txt" --include="*.mk" --include="*.py" --include="*.cmake" --include="Makefile" $'\xFE\xFF' . | while read -r line; do
a=$(head -c 3 "$line")
if [ "${a}" = $'\xFE\xFF' ]; then
echo "${line}" && exit 1
fi
done