File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : DevDocs PR or Issue Creation Notifier
2+ on :
3+ issues :
4+ types : [opened]
5+ pull_request_target :
6+ types : [opened]
7+
8+ jobs :
9+ notify :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : Check for new PR or issues
13+ env :
14+ REPO_NAME : ${{ github.repository }}
15+ # Make sure this secret name matches what is in your Repo Settings
16+ PR_TITLE : ${{ github.event.pull_request.title || github.event.issue.title }}
17+ PR_USER : ${{ github.event.pull_request.user.login || github.event.comment.user.login }}
18+ PR_URL : ${{ github.event.pull_request.html_url || github.event.comment.html_url }}
19+ SLACK_WEBHOOK : ${{ secrets.SLACK_WEBHOOK_URL }}
20+ run : |
21+ # Build Slack payload safely using jq
22+ SLACK_PAYLOAD=$(jq -n \
23+ --arg repo "$REPO_NAME" \
24+ --arg title "$PR_TITLE" \
25+ --arg user "$PR_USER" \
26+ --arg url "$PR_URL" \
27+ '{
28+ "channel": "#docs-devdocs-notifications",
29+ "username": "Issue Notifier",
30+ "icon_emoji": ":mega:",
31+ "text": "*📢 @DevDocs a PR was opened or issue created in * \($repo)\n*Title:* \($title)\n*By:* \($user)\n*URL:* \($url)"
32+ }')
33+
34+ # Send to Slack
35+ curl -X POST \
36+ -H 'Content-type: application/json' \
37+ --data "$SLACK_PAYLOAD" \
38+ "$SLACK_WEBHOOK"
You can’t perform that action at this time.
0 commit comments