Skip to content

Commit ad32dad

Browse files
committed
Use pull_request_target for PR notifications so fork PRs get Slack alerts
pull_request events from forks don't have access to repo secrets, so the SLACK_WEBHOOK was empty and curl silently failed. pull_request_target runs in the base repo context and has access to secrets. Also switched curl -s to curl -sf so HTTP failures surface as workflow failures.
1 parent 9792144 commit ad32dad

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

.github/workflows/notify-pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: PR Notification
22
on:
3-
pull_request:
3+
pull_request_target:
44
types: [opened]
55
jobs:
66
notify:
@@ -12,6 +12,6 @@ jobs:
1212
PR_URL="${{ github.event.pull_request.html_url }}"
1313
PR_AUTHOR="${{ github.event.pull_request.user.login }}"
1414
PR_NUM="${{ github.event.pull_request.number }}"
15-
curl -s -X POST "${{ secrets.SLACK_WEBHOOK }}" \
15+
curl -sf -X POST "${{ secrets.SLACK_WEBHOOK }}" \
1616
-H "Content-Type: application/json" \
1717
-d "{\"text\": \"🔀 New PR #${PR_NUM} on aimock by *${PR_AUTHOR}*: <${PR_URL}|${PR_TITLE}>\"}"

0 commit comments

Comments
 (0)