Skip to content

[Feat] TimeTagSpinner Compose ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ #2

[Feat] TimeTagSpinner Compose ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜

[Feat] TimeTagSpinner Compose ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ #2

name: Slack Notification (Opened/Ready)
on:
pull_request:
types: [opened, ready_for_review]
permissions: {}
concurrency:
group: pr-${{ github.event.pull_request.number }}-slack-opened-ready
cancel-in-progress: true
# ์ตœ์ดˆ ๋ฆฌ๋ทฐ ์š”์ฒญ ์•Œ๋ฆผ
jobs:
notify:
runs-on: ubuntu-latest
steps:
# JSON ํŒŒ์‹ฑ ๋„๊ตฌ
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Notify Initial Reviewers
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 }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
REVIEWERS_JSON: ${{ toJson(github.event.pull_request.requested_reviewers) }}
run: |
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"
author_id=${GITHUB_TO_SLACK[$PR_AUTHOR]}
if [[ -n "$author_id" ]]; then
SLACK_AUTHOR_MENTION="<@$author_id>"
else
SLACK_AUTHOR_MENTION="@${PR_AUTHOR}"
fi
REVIEWER_MENTIONS=""
for reviewer in $(echo "$REVIEWERS_JSON" | jq -r '.[].login'); do
[[ "$reviewer" == *"[bot]" ]] && continue
slack_id=${GITHUB_TO_SLACK[$reviewer]}
[[ -z "$slack_id" ]] && continue
REVIEWER_MENTIONS+="<@$slack_id> "
done
if [ -z "$REVIEWER_MENTIONS" ]; then
echo "๋ฆฌ๋ทฐ์–ด๊ฐ€ ์—†์œผ๋ฏ€๋กœ ์•Œ๋ฆผ ์ƒ๋žต"
exit 0
fi
curl -X POST -H 'Content-type: application/json' \
--data "{\"text\": \"๐Ÿ”ฅ *๋ฆฌ๋ทฐ ์š”์ฒญ ์•Œ๋ฆผ*\n*PR ์ œ๋ชฉ:* ${PR_TITLE} (#${PR_NUMBER})\n*์ž‘์„ฑ์ž:* ${SLACK_AUTHOR_MENTION}\n*๋ฆฌ๋ทฐ์–ด:* ${REVIEWER_MENTIONS}\n*๋งํฌ:* ${PR_URL}\"}" \
$SLACK_WEBHOOK_URL