[Feat] 탐색화면 Compose 마이그레이션 #175
Workflow file for this run
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 Notification (Submitted) | |
| on: | |
| pull_request_review: | |
| types: [ submitted ] | |
| permissions: { } | |
| concurrency: | |
| group: pr-${{ github.event.pull_request.number }}-slack-submitted | |
| cancel-in-progress: true | |
| # 리뷰 완료 알림 | |
| jobs: | |
| notify: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install jq | |
| run: sudo apt-get update && sudo apt-get install -y jq | |
| - name: Notify Review Submitted | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| PR_TITLE: ${{ github.event.pull_request.title }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| PR_URL: ${{ github.event.pull_request.html_url }} | |
| REVIEW_STATE: ${{ github.event.review.state }} | |
| PR_REVIEWER: ${{ github.event.review.user.login }} | |
| PR_AUTHOR: ${{ github.event.pull_request.user.login }} | |
| run: | | |
| if [[ "$REVIEW_STATE" == "commented" ]]; then | |
| echo "단순 코멘트 리뷰는 알림 생략" | |
| exit 0 | |
| fi | |
| REPO_NAME="${GITHUB_REPOSITORY#*/}" | |
| declare -A GITHUB_TO_SLACK | |
| GITHUB_TO_SLACK["soeun2537"]="U09A0LM0CRW" | |
| GITHUB_TO_SLACK["taek2222"]="U099ARRH3D3" | |
| GITHUB_TO_SLACK["changuii"]="U099BR9RNE6" | |
| GITHUB_TO_SLACK["eoehd1ek"]="U0995NANDML" | |
| GITHUB_TO_SLACK["oungsi2000"]="U098U2R57NK" | |
| GITHUB_TO_SLACK["parkjiminnnn"]="U098U8SLXHD" | |
| GITHUB_TO_SLACK["etama123"]="U0995MPSZ62" | |
| SLACK_REVIEWER_ID=${GITHUB_TO_SLACK[$PR_REVIEWER]:-$PR_REVIEWER} | |
| SLACK_AUTHOR_ID=${GITHUB_TO_SLACK[$PR_AUTHOR]:-$PR_AUTHOR} | |
| SLACK_AUTHOR_MENTION="<@$SLACK_AUTHOR_ID>" | |
| if [[ "$PR_REVIEWER" == *"[bot]" ]]; then | |
| echo "Bot 계정 리뷰 요청은 알림 생략" | |
| exit 0 | |
| fi | |
| ICON="" | |
| case "$REVIEW_STATE" in | |
| approved) ICON="✅" ;; | |
| changes_requested) ICON="🔴" ;; | |
| esac | |
| PAYLOAD=$(jq -n \ | |
| --arg icon "$ICON" \ | |
| --arg repo "$REPO_NAME" \ | |
| --arg title "$PR_TITLE" \ | |
| --arg number "$PR_NUMBER" \ | |
| --arg author "$SLACK_AUTHOR_MENTION" \ | |
| --arg state "$REVIEW_STATE" \ | |
| --arg url "$PR_URL" \ | |
| '{ | |
| text: "\($icon) (\($repo)) 리뷰 완료 알림", | |
| blocks: [ | |
| {type: "header", text: {type: "plain_text", text: "\($icon) (\($repo)) 리뷰 완료 알림", emoji: true}}, | |
| {type: "section", text: {type: "mrkdwn", text: "*PR 제목:* \($title) (#\($number))\n*작성자:* \($author)\n*상태:* \($state)\n*링크:* \($url)"}} | |
| ] | |
| }') | |
| curl -X POST -H 'Content-type: application/json' --data "$PAYLOAD" $SLACK_WEBHOOK_URL |