Skip to content

Commit f79841b

Browse files
authored
Refactor Discord notification workflow for PR reviews
1 parent 1b9f80c commit f79841b

1 file changed

Lines changed: 10 additions & 22 deletions

File tree

.github/workflows/discord_notify.yml

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Discord PR Review
22

33
on:
4-
pull_request_review_comment:
5-
types: [created]
64
pull_request_review:
75
types: [submitted]
86

@@ -12,46 +10,36 @@ jobs:
1210
runs-on: ubuntu-latest
1311

1412
steps:
15-
- name: Send PR review comment/review to Discord
13+
- name: Send PR review to Discord
1614
env:
1715
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
1816

19-
EVENT_NAME: ${{ github.event_name }}
2017
PR_TITLE: ${{ github.event.pull_request.title }}
2118
PR_URL: ${{ github.event.pull_request.html_url }}
2219

23-
COMMENT_AUTHOR: ${{ github.event.comment.user.login }}
24-
COMMENT_BODY: ${{ github.event.comment.body }}
25-
COMMENT_URL: ${{ github.event.comment.html_url }}
26-
2720
REVIEW_AUTHOR: ${{ github.event.review.user.login }}
2821
REVIEW_BODY: ${{ github.event.review.body }}
2922
REVIEW_URL: ${{ github.event.review.html_url }}
23+
REVIEW_STATE: ${{ github.event.review.state }}
3024
run: |
3125
set -e
3226
33-
if [ "$EVENT_NAME" = "pull_request_review_comment" ]; then
34-
AUTHOR="$COMMENT_AUTHOR"
35-
BODY="$COMMENT_BODY"
36-
LINK="$COMMENT_URL"
37-
else
38-
AUTHOR="$REVIEW_AUTHOR"
39-
BODY="$REVIEW_BODY"
40-
LINK="$REVIEW_URL"
41-
fi
27+
AUTHOR="$REVIEW_AUTHOR"
28+
BODY="$REVIEW_BODY"
29+
LINK="$REVIEW_URL"
30+
STATE="$REVIEW_STATE"
4231
4332
# 링크가 비면 PR 링크로 fallback
4433
if [ -z "$LINK" ]; then
4534
LINK="$PR_URL"
4635
fi
4736
48-
# ✅ 멀티라인 문자열(문제 원인) 제거: printf로 안전하게 조립
49-
msg=$(printf "%s\n%s\n%s\n%s\n%s\n\n%s\n" \
50-
"📝 PR 리뷰" \
37+
# 상태 표시(approved/changes_requested/commented)
38+
msg=$(printf "%s\n%s\n%s\n%s\n\n%s\n" \
39+
"📝 PR 리뷰 (${STATE})" \
5140
"- PR: ${PR_TITLE}" \
5241
"- 작성자: ${AUTHOR}" \
53-
"- 본문:" \
54-
"${BODY}" \
42+
"- 본문: ${BODY}" \
5543
"🔗 ${LINK}"
5644
)
5745

0 commit comments

Comments
 (0)