Skip to content

Commit 7f9b080

Browse files
Create new-issue-notify.yml
Create action to send Slack message when a new issue is opened.
1 parent 4d2d61e commit 7f9b080

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Issue Opened Slack Notification
2+
3+
# This workflow runs only when a new issue is opened.
4+
on:
5+
issues:
6+
types: [opened]
7+
8+
9+
jobs:
10+
notify_slack_on_issue:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Send Slack Notification for New Issue
14+
run: |
15+
MESSAGE_TEXT="*📢 New Issue Opened in ${{ github.repository }} 📢*\n\n*Issue Title:* ${{ github.event.issue.title }}\n*Opened By:* ${{ github.event.issue.user.login }}\n\n*View Issue:* ${{ github.event.issue.html_url }}"
16+
17+
SLACK_PAYLOAD=$(jq -n \
18+
--arg text "${MESSAGE_TEXT}" \
19+
'{
20+
"channel": "#docs-devdocs-notifications",
21+
"username": "Issue Notifier",
22+
"icon_emoji": ":mega:",
23+
"text": $text
24+
}')
25+
26+
curl -X POST \
27+
-H 'Content-type: application/json' \
28+
--data "$SLACK_PAYLOAD" \
29+
${{ secrets.SLACK_WEBHOOK }}

0 commit comments

Comments
 (0)