-
Notifications
You must be signed in to change notification settings - Fork 8
127 lines (117 loc) · 7.11 KB
/
discord-review.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: 리뷰 생성 시, 디스코드 알림
on:
pull_request_review:
types: [submitted]
issue_comment:
types: [created]
env:
hwinkr: "@해리"
Yoonkyoungme: "@빙봉"
hw0603: "@페드로"
ikjo39: "@다온"
ehBeak: "@배키"
seokmyungham: "@재즈"
Largopie: "@낙타"
seunghye218: "@마크"
jobs:
notify_review:
runs-on: ubuntu-latest
steps:
- name: 모든 팀원이 확인해야 하는 PR에 리뷰가 등록되면 FE, BE 두 채널 모두 디스코드 알림을 보낸다.
if: github.event_name == 'pull_request_review' && contains(github.event.pull_request.title, '[ALL]')
env:
FE_DISCORD_WEBHOOK_URL: ${{ secrets.FE_DISCORD_WEBHOOK_URL }}
BE_DISCORD_WEBHOOK_URL: ${{ secrets.BE_DISCORD_WEBHOOK_URL }}
run: |
REVIEWER=$(jq -r '.review.user.login' < $GITHUB_EVENT_PATH)
REVIEWER_MENTION=$(printenv $REVIEWER)
if [ -z "$REVIEWER_MENTION" ]; then
REVIEWER_MENTION=$REVIEWER
fi
REVIEWER_LINK="[${REVIEWER_MENTION}](https://github.com/${REVIEWER})"
curl -H "Content-Type: application/json" \
-d "{\"content\": \"💬 ${REVIEWER_LINK}님이 새로운 리뷰를 남겼어요! 리뷰를 반영해 주세요.\n\n🔗 [PR 링크](${{ github.event.pull_request.html_url }})\n📄 **제목**: ${{ github.event.pull_request.title }}\"}" \
$FE_DISCORD_WEBHOOK_URL
curl -H "Content-Type: application/json" \
-d "{\"content\": \"💬 ${REVIEWER_LINK}님이 새로운 리뷰를 남겼어요! 리뷰를 반영해 주세요.\n\n🔗 [PR 링크](${{ github.event.pull_request.html_url }})\n📄 **제목**: ${{ github.event.pull_request.title }}\"}" \
$BE_DISCORD_WEBHOOK_URL
- name: 새로운 프론트엔드 리뷰가 등록되면 프론트엔드 채널에 디스코드 알림을 보낸다.
if: github.event_name == 'pull_request_review' && contains(github.event.pull_request.title, '[FE]')
env:
FE_DISCORD_WEBHOOK_URL: ${{ secrets.FE_DISCORD_WEBHOOK_URL }}
run: |
REVIEWER=$(jq -r '.review.user.login' < $GITHUB_EVENT_PATH)
REVIEWER_MENTION=$(printenv $REVIEWER)
if [ -z "$REVIEWER_MENTION" ]; then
REVIEWER_MENTION=$REVIEWER
fi
REVIEWER_LINK="[${REVIEWER_MENTION}](https://github.com/${REVIEWER})"
curl -H "Content-Type: application/json" \
-d "{\"content\": \"💬 ${REVIEWER_LINK}님이 새로운 리뷰를 남겼어요! 리뷰를 반영해 주세요.\n\n🔗 [PR 링크](${{ github.event.pull_request.html_url }})\n📄 **제목**: ${{ github.event.pull_request.title }}\"}" \
$FE_DISCORD_WEBHOOK_URL
- name: 새로운 백엔드 리뷰가 등록되면 백엔드 채널에 디스코드 알림을 보낸다.
if: github.event_name == 'pull_request_review' && contains(github.event.pull_request.title, '[BE]')
env:
BE_DISCORD_WEBHOOK_URL: ${{ secrets.BE_DISCORD_WEBHOOK_URL }}
run: |
REVIEWER=$(jq -r '.review.user.login' < $GITHUB_EVENT_PATH)
REVIEWER_MENTION=$(printenv $REVIEWER)
if [ -z "$REVIEWER_MENTION" ]; then
REVIEWER_MENTION=$REVIEWER
fi
REVIEWER_LINK="[${REVIEWER_MENTION}](https://github.com/${REVIEWER})"
curl -H "Content-Type: application/json" \
-d "{\"content\": \"💬 ${REVIEWER_LINK}님이 새로운 리뷰를 남겼어요! 리뷰를 반영해 주세요.\n\n🔗 [PR 링크](${{ github.event.pull_request.html_url }})\n📄 **제목**: ${{ github.event.pull_request.title }}\"}" \
$BE_DISCORD_WEBHOOK_URL
notify_comment:
runs-on: ubuntu-latest
steps:
- name: 모든 팀원이 확인해야 하는 PR에 코멘트가 등록되면 FE, BE 두 채널 모두 디스코드 알림을 보낸다.
if: github.event.issue.pull_request && contains(github.event.issue.title, '[ALL]')
env:
FE_DISCORD_WEBHOOK_URL: ${{ secrets.FE_DISCORD_WEBHOOK_URL }}
BE_DISCORD_WEBHOOK_URL: ${{ secrets.BE_DISCORD_WEBHOOK_URL }}
run: |
COMMENTER=$(jq -r '.comment.user.login' < $GITHUB_EVENT_PATH)
COMMENTER_MENTION=$(printenv $COMMENTER)
if [ -z "$COMMENTER_MENTION" ]; then
COMMENTER_MENTION=$COMMENTER
fi
COMMENTER_LINK="[${COMMENTER_MENTION}](https://github.com/${COMMENTER})"
COMMENT=$(jq -r '.comment.body' < $GITHUB_EVENT_PATH)
curl -H "Content-Type: application/json" \
-d "{\"content\": \"💬 ${COMMENTER_LINK}님이 새로운 코멘트를 남겼어요!\n\n🔗 [PR 링크](${{ github.event.issue.pull_request.html_url }})\n📄 **제목**: ${{ github.event.issue.title }}\n🗣️ **코멘트 내용**: ${COMMENT}\"}" \
$FE_DISCORD_WEBHOOK_URL
curl -H "Content-Type: application/json" \
-d "{\"content\": \"💬 ${COMMENTER_LINK}님이 새로운 코멘트를 남겼어요!\n\n🔗 [PR 링크](${{ github.event.issue.pull_request.html_url }})\n📄 **제목**: ${{ github.event.issue.title }}\n🗣️ **코멘트 내용**: ${COMMENT}\"}" \
$BE_DISCORD_WEBHOOK_URL
- name: 프론트엔드 PR에 코멘트가 등록되면 디스코드 프론트엔드 채널에 알림을 보낸다.
if: github.event.issue.pull_request && contains(github.event.issue.title, '[FE]')
env:
FE_DISCORD_WEBHOOK_URL: ${{ secrets.FE_DISCORD_WEBHOOK_URL }}
run: |
COMMENTER=$(jq -r '.comment.user.login' < $GITHUB_EVENT_PATH)
COMMENTER_MENTION=$(printenv $COMMENTER)
if [ -z "$COMMENTER_MENTION" ]; then
COMMENTER_MENTION=$COMMENTER
fi
COMMENTER_LINK="[${COMMENTER_MENTION}](https://github.com/${COMMENTER})"
COMMENT=$(jq -r '.comment.body' < $GITHUB_EVENT_PATH)
curl -H "Content-Type: application/json" \
-d "{\"content\": \"💬 ${COMMENTER_LINK}님이 새로운 코멘트를 남겼어요!\n\n🔗 [PR 링크](${{ github.event.issue.pull_request.html_url }})\n📄 **제목**: ${{ github.event.issue.title }}\n🗣️ **코멘트 내용**: ${COMMENT}\"}" \
$FE_DISCORD_WEBHOOK_URL
- name: 백엔드 PR에 코멘트가 등록되면 디스코드 백엔드 채널에 알림을 보낸다.
if: github.event.issue.pull_request && contains(github.event.issue.title, '[BE]')
env:
BE_DISCORD_WEBHOOK_URL: ${{ secrets.BE_DISCORD_WEBHOOK_URL }}
run: |
COMMENTER=$(jq -r '.comment.user.login' < $GITHUB_EVENT_PATH)
COMMENTER_MENTION=$(printenv $COMMENTER)
if [ -z "$COMMENTER_MENTION" ]; then
COMMENTER_MENTION=$COMMENTER
fi
COMMENTER_LINK="[${COMMENTER_MENTION}](https://github.com/${COMMENTER})"
COMMENT=$(jq -r '.comment.body' < $GITHUB_EVENT_PATH)
curl -H "Content-Type: application/json" \
-d "{\"content\": \"💬 ${COMMENTER_LINK}님이 새로운 코멘트를 남겼어요!\n\n🔗 [PR 링크](${{ github.event.issue.pull_request.html_url }})\n📄 **제목**: ${{ github.event.issue.title }}\n🗣️ **코멘트 내용**: ${COMMENT}\"}" \
$BE_DISCORD_WEBHOOK_URL