Skip to content

Commit 1fb9eb7

Browse files
authored
Merge pull request #4856 from wled/copilot/fix-4855
Fix GitHub workflow secret access from forked PRs
2 parents dee581f + cd8ddb8 commit 1fb9eb7

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

.github/workflows/pr-merge.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
name: Notify Discord on PR Merge
22
on:
33
workflow_dispatch:
4-
pull_request:
4+
pull_request_target:
55
types: [closed]
66

77
jobs:
88
notify:
99
runs-on: ubuntu-latest
10+
if: github.event.pull_request.merged == true
1011
steps:
1112
- name: Get User Permission
1213
id: checkAccess
@@ -23,11 +24,6 @@
2324
echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}"
2425
echo "Job originally triggered by ${{ github.actor }}"
2526
exit 1
26-
- name: Checkout code
27-
uses: actions/checkout@v3
28-
with:
29-
ref: ${{ github.event.pull_request.head.sha }} # This is dangerous without the first access check
3027
- name: Send Discord notification
31-
# if: github.event.pull_request.merged == true
3228
run: |
3329
curl -H "Content-Type: application/json" -d '{"content": "Pull Request ${{ github.event.pull_request.number }} merged by ${{ github.actor }}"}' ${{ secrets.DISCORD_WEBHOOK_BETA_TESTERS }}

0 commit comments

Comments
 (0)