Skip to content

Commit

Permalink
Update pr_notification.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
jminkkk authored Oct 17, 2024
1 parent 2f4bade commit 14c96fa
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/pr_notification.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: PR Slack Notification
on:
pull_request:
types: [opened, reopened]
types: [opened, reopened, labeled]
jobs:
notify_reviewers:
runs-on: ubuntu-latest
Expand All @@ -18,7 +18,9 @@ jobs:
PR_TITLE="${{ github.event.pull_request.title }}"
PR_URL="${{ github.event.pull_request.html_url }}"
REVIEWERS='${{ toJson(github.event.pull_request.requested_reviewers.*.login) }}'
LABELS='${{ toJson(github.event.pull_request.labels.*.name) }}'
echo "REVIEWERS: $REVIEWERS"
echo "LABELS: $LABELS"
parse_slack_ids() {
echo "$SLACK_IDS" | jq -r 'to_entries | map("\(.key):\(.value)") | .[]'
Expand All @@ -41,11 +43,15 @@ jobs:
if [ ! -z "$mentions" ]; then
message="$mentions 님, 새로운 PR이 생성되었습니다: <$PR_URL|$PR_TITLE>"
if echo "$LABELS" | jq -e 'contains(["zap"])' > /dev/null; then
message=":rotating_light: 긴급 PR입니다. 빠른 리뷰 부탁드립니다!:rotating_light:\n$message"
fi
curl -X POST -H 'Content-type: application/json' \
--data "{\"text\":\"$message\"}" \
"$SLACK_WEBHOOK_URL"
echo "Sent message: $message"
else
echo "No reviewers to notify"
fi

0 comments on commit 14c96fa

Please sign in to comment.