diff --git a/.github/workflows/pr_bot.yml b/.github/workflows/pr_bot.yml index 22daee4..f9f5838 100644 --- a/.github/workflows/pr_bot.yml +++ b/.github/workflows/pr_bot.yml @@ -7,6 +7,10 @@ on: types: [opened, closed, reopened, synchronize] issue_comment: types: [created] + pull_request_review: + types: [submitted] + pull_request_review_comment: + types: [created] jobs: notify: @@ -23,7 +27,7 @@ jobs: "username": "GitHub PR 봇", "embeds": [{ "title": "Pull Request #${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}", - "description": "**${{ github.actor }}**님이 Pull Request를 생성하거나 업데이트했습니다.", + "description": "**${{ github.actor }}**님이 Pull Request를 생성 또는 업데이트했습니다.", "url": "${{ github.event.pull_request.html_url }}", "color": 2243312 }] @@ -84,3 +88,41 @@ jobs: }] }' \ ${{ secrets.DISCORD_WEBHOOK_URL }} + + # ---------------------------- + # 리뷰 제출(Submit Review) 알림 + # ---------------------------- + - name: Send Review Submitted Notification + if: github.event_name == 'pull_request_review' && github.event.action == 'submitted' + run: | + REVIEW_BODY=$(echo "${{ github.event.review.body }}" | sed 's/"/\\"/g' | sed ':a;N;$!ba;s/\n/\\n/g') + curl -X POST -H "Content-Type: application/json" \ + -d "{ + \"username\": \"GitHub 리뷰 봇\", + \"embeds\": [{ + \"title\": \"New Review on PR #${{ github.event.pull_request.number }}\", + \"description\": \"**${{ github.actor }}**님이 리뷰를 남겼습니다: \\n${REVIEW_BODY}\", + \"url\": \"${{ github.event.review.html_url }}\", + \"color\": 16776960 + }] + }" \ + ${{ secrets.DISCORD_WEBHOOK_URL }} + + # ------------------------- + # 리뷰 댓글에 대한 답글 알림 + # ------------------------- + - name: Send Review Comment Notification + if: github.event_name == 'pull_request_review_comment' && github.event.action == 'created' + run: | + COMMENT_BODY=$(echo "${{ github.event.comment.body }}" | sed 's/"/\\"/g' | sed ':a;N;$!ba;s/\n/\\n/g') + curl -X POST -H "Content-Type: application/json" \ + -d "{ + \"username\": \"GitHub 댓글 봇\", + \"embeds\": [{ + \"title\": \"New Reply on PR #${{ github.event.pull_request.number }}\", + \"description\": \"**${{ github.actor }}**님의 새 답글: \\n${COMMENT_BODY}\", + \"url\": \"${{ github.event.comment.html_url }}\", + \"color\": 15105570 + }] + }" \ + ${{ secrets.DISCORD_WEBHOOK_URL }} \ No newline at end of file