|
15 | 15 | description: 'Target branch for supabase-js tests' |
16 | 16 | type: string |
17 | 17 | default: 'master' |
18 | | - |
19 | | - # Push to master - only when source code changes |
| 18 | + |
| 19 | + # Push to main - only when source code changes |
20 | 20 | push: |
21 | 21 | branches: |
22 | | - - master |
| 22 | + - main |
23 | 23 | paths: |
24 | 24 | - 'src/**' |
25 | 25 | - 'package.json' |
26 | 26 | - 'package-lock.json' |
27 | 27 | - 'tsconfig.json' |
28 | | - |
| 28 | + |
29 | 29 | # PR triggers - only when labeled |
30 | | - pull_request: |
| 30 | + # Using pull_request_target to access secrets when PRs come from forks |
| 31 | + pull_request_target: |
31 | 32 | types: [labeled, synchronize] |
32 | 33 |
|
33 | 34 | jobs: |
34 | 35 | preview: |
35 | | - # Run only for PRs with 'trigger: preview' label or pushes to master |
| 36 | + # Run only for PRs with 'trigger: preview' label or pushes to main |
36 | 37 | if: > |
37 | 38 | github.repository == 'supabase/functions-js' && |
38 | 39 | ( |
|
47 | 48 | steps: |
48 | 49 | - name: Checkout code |
49 | 50 | 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 }} |
50 | 54 |
|
51 | 55 | - name: Setup Node.js |
52 | 56 | uses: actions/setup-node@v4 |
@@ -106,10 +110,10 @@ jobs: |
106 | 110 | script: | |
107 | 111 | const prNumber = context.issue.number || 'push'; |
108 | 112 | const triggeringRepo = context.repo.repo; |
109 | | - // Use input target_branch if workflow_dispatch, otherwise default to master |
| 113 | + // Use input target_branch if workflow_dispatch, otherwise default to main |
110 | 114 | const targetBranch = context.eventName === 'workflow_dispatch' && context.payload.inputs?.target_branch |
111 | 115 | ? context.payload.inputs.target_branch |
112 | | - : 'master'; |
| 116 | + : 'main'; |
113 | 117 |
|
114 | 118 | try { |
115 | 119 | const response = await github.rest.actions.createWorkflowDispatch({ |
@@ -153,11 +157,11 @@ jobs: |
153 | 157 | body: | |
154 | 158 | <!-- functions-js-preview-status --> |
155 | 159 | 🚀 **Preview release created!** |
156 | | -
|
| 160 | + |
157 | 161 | supabase-js CI tests have been automatically triggered on feature branch to verify compatibility. |
158 | | -
|
| 162 | + |
159 | 163 | **Preview package:** `${{ needs.preview.outputs.preview-url }}` |
160 | | -
|
| 164 | + |
161 | 165 | Results will be posted here once testing is complete. |
162 | | -
|
| 166 | + |
163 | 167 | edit-mode: replace |
0 commit comments