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 : PR Notification
2+ on :
3+ pull_request_target :
4+ types : [opened]
5+ jobs :
6+ notify :
7+ runs-on : ubuntu-latest
8+ steps :
9+ - name : Notify Slack
10+ if : github.actor != 'github-actions[bot]'
11+ env :
12+ SLACK_WEBHOOK : ${{ secrets.SLACK_WEBHOOK }}
13+ PR_TITLE : ${{ github.event.pull_request.title }}
14+ PR_URL : ${{ github.event.pull_request.html_url }}
15+ PR_AUTHOR : ${{ github.event.pull_request.user.login }}
16+ PR_NUM : ${{ github.event.pull_request.number }}
17+ REPO_NAME : ${{ github.event.repository.name }}
18+ run : |
19+ if [ -z "$SLACK_WEBHOOK" ]; then echo "SLACK_WEBHOOK not set, skipping"; exit 0; fi
20+ PAYLOAD=$(jq -n \
21+ --arg text "New PR #${PR_NUM} on ${REPO_NAME} by *${PR_AUTHOR}*: <${PR_URL}|${PR_TITLE}>" \
22+ '{text: $text}')
23+ curl -sf -X POST "$SLACK_WEBHOOK" \
24+ -H "Content-Type: application/json" \
25+ -d "$PAYLOAD"
You can’t perform that action at this time.
0 commit comments