Skip to content

Commit c29008c

Browse files
committed
ci: improve line break check ci to change file automatically
1 parent c10802e commit c29008c

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

β€Ž.github/workflows/integration.yamlβ€Ž

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Integration πŸ”„
22

3+
permissions:
4+
contents: write
5+
pull-requests: write
6+
37
on:
48
pull_request:
59

@@ -41,7 +45,7 @@ jobs:
4145
echo "ν˜„μž¬ 컀밋: ${{ github.sha }}"
4246
4347
files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | tr -d '"')
44-
success=true
48+
target_file_list=()
4549
4650
echo "πŸ“ λ³€κ²½λœ 파일 λͺ©λ‘:"
4751
echo "$files"
@@ -50,17 +54,30 @@ jobs:
5054
for file in $files; do
5155
echo "검사 쀑: $file"
5256
if [ -s "$file" ] && [ "$(tail -c 1 $file | wc -l)" -eq 0 ]; then
53-
echo "❌ μ€„λ°”κΏˆ λˆ„λ½: $file"
57+
# κ°œν–‰ μΆ”κ°€
58+
echo >> "$file"
59+
echo "✏️ κ°œν–‰ μΆ”κ°€: $file"
5460
echo "- $file" >> $GITHUB_STEP_SUMMARY
55-
success=false
61+
target_file_list+=("$file")
5662
else
5763
echo "βœ… 정상: $file"
5864
fi
5965
done
6066
61-
if [ "$success" = false ]; then
62-
echo "⚠️ μ€„λ°”κΏˆ 검사 μ‹€νŒ¨"
63-
echo -e "\n:warning: 파일 끝의 λˆ„λ½λœ μ€„λ°”κΏˆμ„ μΆ”κ°€ν•΄ μ£Όμ„Έμš”." >> $GITHUB_STEP_SUMMARY
67+
if [ "${#target_file_list[@]}" -gt 0 ]; then
68+
echo -e "\nμžλ™ μˆ˜μ •λœ 파일 수: ${#target_file_list[@]}" >> "$GITHUB_STEP_SUMMARY"
69+
70+
# μœ μ € μ„€μ •
71+
git config --global user.name "${GITHUB_ACTOR}"
72+
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
73+
74+
# λ³€κ²½λΆ„ 컀밋 & ν‘Έμ‹œ
75+
git checkout "${GITHUB_HEAD_REF}"
76+
git add -A
77+
git commit -m "chore(ci): add missing trailing newline to files"
78+
git push origin "HEAD:${GITHUB_HEAD_REF}"
79+
80+
echo "βœ… λˆ„λ½λœ κ°œν–‰ μžλ™ μΆ”κ°€ 및 컀밋/ν‘Έμ‹œ μ™„λ£Œ"
6481
exit 1
6582
else
6683
echo "βœ… λͺ¨λ“  파일의 μ€„λ°”κΏˆ 정상"

0 commit comments

Comments
Β (0)