-
Notifications
You must be signed in to change notification settings - Fork 2
37 lines (32 loc) Β· 1.29 KB
/
discord-notify.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
name: Notify Discord on PR Events
on:
pull_request:
types:
- opened
- closed
jobs:
notify-discord:
runs-on: ubuntu-latest
steps:
- name: Send Discord Notification
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
run: |
PR_ACTION="${{ github.event.action }}"
PR_URL="${{ github.event.pull_request.html_url }}"
PR_TITLE="${{ github.event.pull_request.title }}"
PR_AUTHOR="${{ github.event.pull_request.user.login }}"
PR_MERGED="${{ github.event.pull_request.merged }}"
# PR μμ± μλ¦Ό
if [[ "$PR_ACTION" == "opened" ]]; then
curl -X POST -H "Content-Type: application/json" \
-d '{
"content": "**ν΄μ λ¨μ PRμ `LGTM`μ΄λ λ§μ μμ΄**\nπ PR: '"$PR_URL"'\nπ Title: '"$PR_TITLE"'\nπ€ Author: '"$PR_AUTHOR"'"
}' $DISCORD_WEBHOOK_URL
# PR λ¨Έμ§ μλ¦Ό
elif [[ "$PR_ACTION" == "closed" && "$PR_MERGED" == "true" ]]; then
curl -X POST -H "Content-Type: application/json" \
-d '{
"content": "**μ무 μΌ μμλ€**\nπ PR: '"$PR_URL"'\nπ Title: '"$PR_TITLE"'\nπ€ Author: '"$PR_AUTHOR"'"
}' $DISCORD_WEBHOOK_URL
fi