Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Integration 🔄

permissions:
contents: write
pull-requests: write

on:
pull_request:

Expand Down Expand Up @@ -41,7 +45,7 @@ jobs:
echo "현재 커밋: ${{ github.sha }}"

files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | tr -d '"')
success=true
target_file_list=()

echo "📝 변경된 파일 목록:"
echo "$files"
Expand All @@ -50,18 +54,30 @@ jobs:
for file in $files; do
echo "검사 중: $file"
if [ -s "$file" ] && [ "$(tail -c 1 $file | wc -l)" -eq 0 ]; then
echo "❌ 줄바꿈 누락: $file"
# 개행 추가
echo >> "$file"
echo "✏️ 개행 추가: $file"
echo "- $file" >> $GITHUB_STEP_SUMMARY
success=false
target_file_list+=("$file")
else
echo "✅ 정상: $file"
fi
done

if [ "$success" = false ]; then
echo "⚠️ 줄바꿈 검사 실패"
echo -e "\n:warning: 파일 끝의 누락된 줄바꿈을 추가해 주세요." >> $GITHUB_STEP_SUMMARY
exit 1
if [ "${#target_file_list[@]}" -gt 0 ]; then
echo -e "\n자동 수정된 파일 수: ${#target_file_list[@]}" >> "$GITHUB_STEP_SUMMARY"

# 유저 설정
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"

# 변경분 커밋 & 푸시
git checkout "${GITHUB_HEAD_REF}"
git add -A
git commit -m "chore(ci): add missing trailing newline to files"
git push origin "HEAD:${GITHUB_HEAD_REF}"

echo "✅ 누락된 개행 자동 추가 및 커밋/푸시 완료"
else
echo "✅ 모든 파일의 줄바꿈 정상"
fi
Expand Down Expand Up @@ -117,7 +133,8 @@ jobs:
merge_base=$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})
echo "Merge base 커밋: $merge_base"

files=$(git diff --name-only $merge_base ${{ github.event.pull_request.head.sha }} | tr -d '"')
# .github 디렉토리 하위 파일 제외하고 대상 파일로 지정
files=$(git diff --name-only "$merge_base" ${{ github.event.pull_request.head.sha }} -- . ':(exclude).github/**' | tr -d '"')
pr_author="${{ github.event.pull_request.user.login }}"
success=true

Expand Down