-
Notifications
You must be signed in to change notification settings - Fork 126
69 lines (58 loc) ยท 2.58 KB
/
integration.yaml
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: ๐ Integration
on:
pull_request:
jobs:
linelint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for 1. missing end line breaks and 2. control characters in filenames
run: |
# ๋ฐ์ดํ๋ฅผ ์ ๊ฑฐํ๊ณ ํ์ผ ๋ชฉ๋ก ๊ฐ์ ธ์ค๊ธฐ
files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | tr -d '"')
echo "๋ณ๊ฒฝ๋ ํ์ผ ๋ชฉ๋ก:"
echo "$files"
success=true
# ์ค๋ฐ๊ฟ ์ฒดํฌ
echo "## ์ค๋ฐ๊ฟ ๋๋ฝ ํ์ผ" >> $GITHUB_STEP_SUMMARY
for file in $files; do
if [ -s "$file" ] && [ "$(tail -c 1 $file | wc -l)" -eq 0 ]; then
echo "๋ฐ๊ฒฌ๋ ์ค๋ฐ๊ฟ ๋๋ฝ: $file"
echo "- $file" >> $GITHUB_STEP_SUMMARY
success=false
fi
done
# ์ ์ด๋ฌธ์ ์ฒดํฌ
echo -e "\n## ์ ์ด๋ฌธ์๊ฐ ํฌํจ๋ ํ์ผ๋ช
" >> $GITHUB_STEP_SUMMARY
for file in $files; do
# basename์ผ๋ก ํ์ผ๋ช
๋ง ์ถ์ถํ๊ณ ๋ฐ์ดํ ์ ๊ฑฐ
filename=$(basename "$file" | tr -d '"')
# ๋ฐฑ์ฌ๋์๋ก ์์ํ๋ ์ ์ด๋ฌธ์๋ค ์ฒดํฌ (\b, \n, \r, \t ๋ฑ)
if printf '%q' "$filename" | grep -q '\\[bnrtfv]'; then
echo "- $file (์ ์ด๋ฌธ์ ํฌํจ)" >> $GITHUB_STEP_SUMMARY
success=false
fi
# ์ผ๋ฐ์ ์ธ ์ ์ด๋ฌธ์๋ค ์ฒดํฌ (0x00-0x1F, 0x7F)
if echo -n "$filename" | LC_ALL=C grep -q '[[:cntrl:]]'; then
echo "- $file (์ ์ด๋ฌธ์ ํฌํจ)" >> $GITHUB_STEP_SUMMARY
success=false
fi
# ํน์ ์ ์ด๋ฌธ์๋ค ์ฒดํฌ
if echo -n "$filename" | grep -q $'[\x00-\x1F\x7F]'; then
echo "- $file (์ ์ด๋ฌธ์ ํฌํจ)" >> $GITHUB_STEP_SUMMARY
success=false
fi
# ์ด์ค์ผ์ดํ ์ํ์ค ์ฒดํฌ
if [[ "$filename" =~ (\\[0-7]{1,3}|\\x[0-9a-fA-F]{1,2}) ]]; then
echo "- $file (์ ์ด๋ฌธ์ ํฌํจ)" >> $GITHUB_STEP_SUMMARY
success=false
fi
done
if [ "$success" = false ]; then
echo -e "\n:warning: ์ ๋ฌธ์ ๋ค์ ํด๊ฒฐํด ์ฃผ์ธ์:" >> $GITHUB_STEP_SUMMARY
echo "1. ํ์ผ ๋์ ๋๋ฝ๋ ์ค๋ฐ๊ฟ์ ์ถ๊ฐํด ์ฃผ์ธ์." >> $GITHUB_STEP_SUMMARY
echo "2. ํ์ผ๋ช
์์ ์ ์ด๋ฌธ์๋ฅผ ์ ๊ฑฐํด ์ฃผ์ธ์." >> $GITHUB_STEP_SUMMARY
exit 1
fi