Skip to content

Commit be9a27c

Browse files
authored
chore: fix preview release to use correct target (#1104)
## What kind of change does this PR introduce? Change event trigger from `pull_request` to `pull_request_target`. ## What is the current behavior? Event for triggering a PR release is `pull_request`. This results in PRs from forks not being able to trigger the cross-repo testing. ## What is the new behavior? Event trigger is now `pull_request_target`. Using `pull_request_target` allows access to secrets when PRs come from forks. This is secure, since only us, maintainers, can add the label to trigger the PR release.
1 parent 3a147b5 commit be9a27c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

.github/workflows/preview-release.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ on:
1515
description: 'Target branch for supabase-js tests'
1616
type: string
1717
default: 'master'
18-
18+
1919
# Push to master - only when source code changes
2020
push:
2121
branches:
@@ -25,7 +25,7 @@ on:
2525
- 'package.json'
2626
- 'package-lock.json'
2727
- 'tsconfig.json'
28-
28+
2929
# PR triggers - only when labeled
3030
# Using pull_request_target to access secrets when PRs come from forks
3131
pull_request_target:
@@ -48,6 +48,9 @@ jobs:
4848
steps:
4949
- name: Checkout code
5050
uses: actions/checkout@v4
51+
with:
52+
# For pull_request_target, we need to explicitly checkout the PR's head
53+
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
5154

5255
- name: Setup Node.js
5356
uses: actions/setup-node@v4
@@ -154,11 +157,11 @@ jobs:
154157
body: |
155158
<!-- auth-js-preview-status -->
156159
🚀 **Preview release created!**
157-
160+
158161
supabase-js CI tests have been automatically triggered on feature branch to verify compatibility.
159-
162+
160163
**Preview package:** `${{ needs.preview.outputs.preview-url }}`
161-
164+
162165
Results will be posted here once testing is complete.
163-
166+
164167
edit-mode: replace

0 commit comments

Comments
 (0)