File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 16
16
id : pr-labels
17
17
run : |
18
18
pr_number="${{ github.event.pull_request.number }}"
19
- labels=$(gh pr view $pr_number --json labels -q '.labels[].name' || echo "")
20
- echo "labels=$labels" >> $GITHUB_OUTPUT
19
+ labels_json=$(gh pr view $pr_number --json labels -q '.labels[].name')
20
+ if [ -n "$labels_json" ]; then
21
+ echo "has_maintenance=$(echo $labels_json | grep -q 'maintenance' && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
22
+ else
23
+ echo "has_maintenance=false" >> $GITHUB_OUTPUT
24
+ fi
21
25
env :
22
26
GH_TOKEN : ${{ github.token }}
23
27
26
30
# 필요한 값들 미리 설정
27
31
pr_author="${{ github.event.pull_request.user.login }}"
28
32
pr_number="${{ github.event.pull_request.number }}"
29
- pr_labels =$(gh pr view $pr_number --json labels -q '.labels[].name' || echo "" )
33
+ has_maintenance =$(gh pr view $pr_number --json labels -q '.labels[].name | contains(["maintenance"])' )
30
34
31
35
# 따옴표를 제거하고 파일 목록 가져오기
32
36
files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | tr -d '"')
77
81
done
78
82
79
83
# maintenance 라벨이 없는 경우에만 파일명 규칙 체크
80
- if [[ ! "$pr_labels" =~ "maintenance" ] ]; then
84
+ if [ "$has_maintenance" != "true" ]; then
81
85
echo -e "\n## 파일명 규칙 위반" >> $GITHUB_STEP_SUMMARY
82
86
for file in $files; do
83
87
if [ -f "$file" ]; then
You can’t perform that action at this time.
0 commit comments