Discord PR 알림을 Slack으로 교체 #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Slack PR Notifications | |
| on: | |
| pull_request: | |
| types: [review_requested] | |
| 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: | |
| SLACK_WEBHOOK: ${{ secrets.SLACK_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") | |
| SLACK_MENTION="<@U0AKQT3ATF1>" | |
| ;; | |
| "dogmania") | |
| SLACK_MENTION="<@U0AL88TS412>" | |
| ;; | |
| *) | |
| SLACK_MENTION="@$REQUESTED_REVIEWER" | |
| ;; | |
| esac | |
| curl -H "Content-Type: application/json" \ | |
| -X POST \ | |
| -d "{\"text\": \"$SLACK_MENTION 리뷰 요청이 왔어요! 👀\", \"attachments\": [{\"title\": \"#$PR_NUMBER $PR_TITLE\", \"title_link\": \"$PR_URL\", \"color\": \"#58B9FF\"}]}" \ | |
| $SLACK_WEBHOOK | |
| review-completed-notify: | |
| if: | | |
| github.event_name == 'pull_request_review' && | |
| github.event.review.user.type != 'Bot' && | |
| github.event.review.user.login != github.event.pull_request.user.login && | |
| github.event.review.state != 'commented' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Send Review Completed Notification | |
| env: | |
| SLACK_WEBHOOK: ${{ secrets.SLACK_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="<@U0AKQT3ATF1>" | |
| ;; | |
| "dogmania") | |
| AUTHOR_MENTION="<@U0AL88TS412>" | |
| ;; | |
| *) | |
| AUTHOR_MENTION="@$AUTHOR" | |
| ;; | |
| esac | |
| case "$REVIEW_STATE" in | |
| "changes_requested") | |
| MESSAGE="수정 요청이 있습니다 🔧" | |
| COLOR="#E01E5A" | |
| ;; | |
| *) | |
| MESSAGE="리뷰가 완료되었습니다 📝" | |
| COLOR="#58B9FF" | |
| ;; | |
| esac | |
| curl -H "Content-Type: application/json" \ | |
| -X POST \ | |
| -d "{\"text\": \"$AUTHOR_MENTION $MESSAGE\", \"attachments\": [{\"title\": \"#$PR_NUMBER $PR_TITLE\", \"title_link\": \"$PR_URL\", \"color\": \"$COLOR\"}]}" \ | |
| $SLACK_WEBHOOK |