Skip to content

Commit 50ed202

Browse files
authored
Add Slack notification workflow for issues and PRs
1 parent d619c8d commit 50ed202

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

.github/workflows/slack-notify.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Slack Notifications
2+
on:
3+
issues:
4+
types: [opened]
5+
pull_request:
6+
types: [opened]
7+
issue_comment:
8+
types: [created]
9+
10+
jobs:
11+
notify:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Send to Slack
15+
run: |
16+
if [ "${{ github.event_name }}" = "issues" ]; then
17+
TITLE="${{ github.event.issue.title }}"
18+
URL="${{ github.event.issue.html_url }}"
19+
EVENT="🟢 New Issue"
20+
elif [ "${{ github.event_name }}" = "pull_request" ]; then
21+
TITLE="${{ github.event.pull_request.title }}"
22+
URL="${{ github.event.pull_request.html_url }}"
23+
EVENT="🔵 New PR"
24+
elif [ "${{ github.event_name }}" = "issue_comment" ]; then
25+
TITLE="${{ github.event.issue.title }}"
26+
URL="${{ github.event.comment.html_url }}"
27+
EVENT="💬 New Comment"
28+
fi
29+
30+
curl -X POST "${{ secrets.SLACK_WEBHOOK_URL }}" \
31+
-H "Content-Type: application/json" \
32+
-d "{\"repo\":\"${{ github.repository }}\",\"event\":\"$EVENT\",\"title\":\"$TITLE\",\"url\":\"$URL\",\"user\":\"${{ github.actor }}\"}"

0 commit comments

Comments
 (0)