-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (43 loc) · 1.58 KB
/
check-lint.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
name: Check Line Linting
on:
pull_request:
jobs:
linelint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# PR 라벨 확인
- name: Get PR labels
id: pr-labels
run: |
pr_number="${{ github.event.pull_request.number }}"
labels_json=$(gh pr view $pr_number --json labels -q '.labels[].name')
if [ -n "$labels_json" ]; then
echo "has_maintenance=$(echo $labels_json | grep -q 'maintenance' && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
else
echo "has_maintenance=false" >> $GITHUB_OUTPUT
fi
env:
GH_TOKEN: ${{ github.token }}
# 줄바꿈 체크
- name: Check for missing end line breaks
run: |
# 따옴표를 제거하고 파일 목록 가져오기
files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | tr -d '"')
success=true
echo "변경된 파일 목록:"
echo "$files"
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
if [ "$success" = false ]; then
echo -e "\n:warning: 파일 끝의 누락된 줄바꿈을 추가해 주세요." >> $GITHUB_STEP_SUMMARY
exit 1
fi