From bae5fc0053d0e87c0cdc56f0d74c117ae30a31e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=8E=98=ED=86=A0?= <84930748+chanho0908@users.noreply.github.com> Date: Mon, 23 Mar 2026 12:18:06 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9C=A8=20Feat=20:=20Add=20Slack=20notifi?= =?UTF-8?q?cations=20for=20PR=20review=20events?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/slack-pr-notify-ci | 83 ++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 .github/workflows/slack-pr-notify-ci diff --git a/.github/workflows/slack-pr-notify-ci b/.github/workflows/slack-pr-notify-ci new file mode 100644 index 00000000..175c35ad --- /dev/null +++ b/.github/workflows/slack-pr-notify-ci @@ -0,0 +1,83 @@ +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 From c45f0b1f47faea43cb1f3b3094867d04786f21be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=8E=98=ED=86=A0?= <84930748+chanho0908@users.noreply.github.com> Date: Mon, 23 Mar 2026 12:27:13 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor:=20modify=20f?= =?UTF-8?q?ile=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/{slack-pr-notify-ci => slack-pr-notify-ci.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{slack-pr-notify-ci => slack-pr-notify-ci.yml} (100%) diff --git a/.github/workflows/slack-pr-notify-ci b/.github/workflows/slack-pr-notify-ci.yml similarity index 100% rename from .github/workflows/slack-pr-notify-ci rename to .github/workflows/slack-pr-notify-ci.yml From 18e6017b8117d795f98335ad687b1690b14e16ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=8E=98=ED=86=A0?= <84930748+chanho0908@users.noreply.github.com> Date: Mon, 23 Mar 2026 12:30:23 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor:=20Refactor?= =?UTF-8?q?=20Slack=20notification=20payload=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/slack-pr-notify-ci.yml | 37 +++++++++++++++++++----- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/.github/workflows/slack-pr-notify-ci.yml b/.github/workflows/slack-pr-notify-ci.yml index 175c35ad..c605bcf8 100644 --- a/.github/workflows/slack-pr-notify-ci.yml +++ b/.github/workflows/slack-pr-notify-ci.yml @@ -27,14 +27,24 @@ jobs: SLACK_MENTION="<@U0AL88TS412>" ;; *) - SLACK_MENTION="@$REQUESTED_REVIEWER" + echo "Slack user mapping not found for: $REQUESTED_REVIEWER" >&2 + exit 1 ;; esac - curl -H "Content-Type: application/json" \ + PAYLOAD=$(jq -n \ + --arg text "$SLACK_MENTION 리뷰 요청이 왔어요! 👀" \ + --arg title "#$PR_NUMBER $PR_TITLE" \ + --arg url "$PR_URL" \ + '{text: $text, attachments: [{title: $title, title_link: $url, color: "#58B9FF"}]}') + + curl --fail-with-body \ + --max-time 10 \ + --retry 2 \ + -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 + -d "$PAYLOAD" \ + "$SLACK_WEBHOOK" review-completed-notify: if: | @@ -62,7 +72,8 @@ jobs: AUTHOR_MENTION="<@U0AL88TS412>" ;; *) - AUTHOR_MENTION="@$AUTHOR" + echo "Slack user mapping not found for: $AUTHOR" >&2 + exit 1 ;; esac @@ -77,7 +88,17 @@ jobs: ;; esac - curl -H "Content-Type: application/json" \ + PAYLOAD=$(jq -n \ + --arg text "$AUTHOR_MENTION $MESSAGE" \ + --arg title "#$PR_NUMBER $PR_TITLE" \ + --arg url "$PR_URL" \ + --arg color "$COLOR" \ + '{text: $text, attachments: [{title: $title, title_link: $url, color: $color}]}') + + curl --fail-with-body \ + --max-time 10 \ + --retry 2 \ + -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 + -d "$PAYLOAD" \ + "$SLACK_WEBHOOK"