File tree 1 file changed +29
-7
lines changed
1 file changed +29
-7
lines changed Original file line number Diff line number Diff line change 1
1
name : ' Preview Deployment'
2
2
on :
3
3
pull_request_target :
4
+ types : [opened, synchronize, reopened]
4
5
branches :
5
6
- master
6
7
7
8
jobs :
8
- deploy :
9
- permissions :
10
- actions : read
11
- contents : read
12
- deployments : write
13
- pull-requests : write
9
+ # Job 1: Build the code (no secrets here)
10
+ build :
14
11
runs-on : ubuntu-latest
15
- timeout-minutes : 5
16
12
steps :
17
13
- name : Checkout code
18
14
uses : actions/checkout@v4
15
+ with :
16
+ ref : ${{ github.event.pull_request.head.sha }}
17
+ persist-credentials : false # Don't persist GitHub token
19
18
20
19
- name : Cache node_modules
21
20
uses : actions/cache@v4
32
31
- run : yarn install
33
32
- run : yarn build
34
33
34
+ - name : Upload build artifact
35
+ uses : actions/upload-artifact@v4
36
+ with :
37
+ name : dist-files
38
+ path : src/dist
39
+
40
+ # Job 2: Deploy with secrets (no PR code checkout)
41
+ deploy :
42
+ needs : build # Wait for build job to complete
43
+ permissions :
44
+ actions : read
45
+ contents : read
46
+ deployments : write
47
+ issues : write
48
+ pull-requests : write
49
+ runs-on : ubuntu-latest
50
+ steps :
51
+ - name : Download build artifact
52
+ uses : actions/download-artifact@v4
53
+ with :
54
+ name : dist-files
55
+ path : src/dist
56
+
35
57
- name : Deploy to Cloudflare
36
58
id : deploy
37
59
uses : cloudflare/wrangler-action@v3
You can’t perform that action at this time.
0 commit comments