Skip to content

Commit 2685fce

Browse files
Merge pull request #51 from Rajesh-Nagarajan-11/build-fix
Fix Fork PR:
2 parents c4301b0 + 2f81bb6 commit 2685fce

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

.github/workflows/build-and-preview-site.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Build and Preview Site
22
on:
3-
pull_request:
3+
pull_request_target:
44
branches: [master]
55
types: [opened, synchronize, reopened, closed]
66

@@ -18,6 +18,8 @@ jobs:
1818
steps:
1919
- name: Checkout 🛎️
2020
uses: actions/checkout@v6
21+
with:
22+
ref: ${{ github.event.pull_request.head.sha }}
2123

2224
- name: Install and Build 🔧
2325
env:
@@ -46,7 +48,7 @@ jobs:
4648
preview:
4749
needs: build
4850
runs-on: ubuntu-latest
49-
if: github.event_name == 'pull_request'
51+
if: github.event_name == 'pull_request_target'
5052
permissions:
5153
contents: write
5254
pull-requests: write
@@ -55,14 +57,14 @@ jobs:
5557
uses: actions/checkout@v6
5658

5759
- name: Download pre-built site
58-
if: github.event_name == 'pull_request'
60+
if: github.event_name == 'pull_request_target'
5961
uses: actions/download-artifact@v4
6062
with:
6163
name: public-dir
6264
path: .
6365

6466
- name: Extract site
65-
if: github.event_name == 'pull_request'
67+
if: github.event_name == 'pull_request_target'
6668
run: |
6769
unzip -q public-dir.zip
6870
# Ensure the extracted folder has the static files in a 'public' dir for the action
@@ -73,14 +75,14 @@ jobs:
7375
fi
7476
7577
- name: Deploy Preview
76-
if: github.event_name == 'pull_request' && github.event.action != 'closed'
78+
if: github.event_name == 'pull_request_target' && github.event.action != 'closed'
7779
uses: rossjrw/pr-preview-action@v1.6.3
7880
with:
7981
source-dir: public
8082
token: ${{ secrets.GITHUB_TOKEN }}
8183

8284
- name: Remove Preview on Close
83-
if: github.event_name == 'pull_request' && github.event.action == 'closed'
85+
if: github.event_name == 'pull_request_target' && github.event.action == 'closed'
8486
uses: rossjrw/pr-preview-action@v1.6.3
8587
with:
8688
source-dir: public

0 commit comments

Comments
 (0)