diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index c0ae2d81f..51f86c066 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -1,5 +1,9 @@ name: Integration πŸ”„ +permissions: + contents: write + pull-requests: write + on: pull_request: @@ -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" @@ -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 @@ -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