Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions .github/workflows/discord-pr-notify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Discord PR Notifications

on:
pull_request:
types: [review_requested, closed]
pull_request_review:
types: [submitted]

jobs:
review-request-notify:
if: github.event.action == 'review_requested'
runs-on: ubuntu-latest
steps:
- name: Send Review Request Notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }}
REQUESTED_REVIEWER: ${{ github.event.requested_reviewer.login }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_URL: ${{ github.event.pull_request.html_url }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
case "$REQUESTED_REVIEWER" in
"chanho0908"|"JoungPeto0908")
DISCORD_MENTION="<@379613882001391626>"
;;
"dogmania")
DISCORD_MENTION="<@951268632770531399>"
;;
*)
DISCORD_MENTION="@$REQUESTED_REVIEWER"
;;
esac

curl -H "Content-Type: application/json" \
-X POST \
-d "{\"content\": \"$DISCORD_MENTION 리뷰 요청이 왔어요! 👀\", \"embeds\": [{\"title\": \"#$PR_NUMBER $PR_TITLE\", \"url\": \"$PR_URL\", \"color\": 5814783}]}" \
$DISCORD_WEBHOOK

review-completed-notify:
if: github.event_name == 'pull_request_review'
runs-on: ubuntu-latest
steps:
- name: Send Review Completed Notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }}
REVIEWER: ${{ github.event.review.user.login }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_URL: ${{ github.event.pull_request.html_url }}
AUTHOR: ${{ github.event.pull_request.user.login }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REVIEW_STATE: ${{ github.event.review.state }}
run: |
case "$AUTHOR" in
"chanho0908"|"JoungPeto0908")
AUTHOR_MENTION="<@379613882001391626>"
;;
"dogmania")
AUTHOR_MENTION="<@951268632770531399>"
;;
*)
AUTHOR_MENTION="@$AUTHOR"
;;
esac

case "$REVIEW_STATE" in
"changes_requested")
MESSAGE="수정 요청이 있습니다 🔧"
COLOR=15158332
;;
"commented")
MESSAGE="리뷰 코멘트가 달렸습니다 💬"
COLOR=10181046
;;
*)
MESSAGE="리뷰가 완료되었습니다 📝"
COLOR=5814783
;;
esac

curl -H "Content-Type: application/json" \
-X POST \
-d "{\"content\": \"$AUTHOR_MENTION $MESSAGE\", \"embeds\": [{\"title\": \"#$PR_NUMBER $PR_TITLE\", \"url\": \"$PR_URL\", \"color\": $COLOR}]}" \
$DISCORD_WEBHOOK

merge-notify:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Send Merge Notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_URL: ${{ github.event.pull_request.html_url }}
AUTHOR: ${{ github.event.pull_request.user.login }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
case "$AUTHOR" in
"chanho0908"|"JoungPeto0908")
AUTHOR_MENTION="<@379613882001391626>"
;;
"dogmania")
AUTHOR_MENTION="<@951268632770531399>"
;;
*)
AUTHOR_MENTION="@$AUTHOR"
;;
esac

curl -H "Content-Type: application/json" \
-X POST \
-d "{\"content\": \"🎉 PR이 머지되었습니다! $AUTHOR_MENTION\", \"embeds\": [{\"title\": \"#$PR_NUMBER $PR_TITLE\", \"url\": \"$PR_URL\", \"color\": 3066993}]}" \
$DISCORD_WEBHOOK
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Twix - Android Multi-Module Project
# Twix 🔥