Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/build-and-preview-site.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Build and Preview Site
on:
pull_request:
pull_request_target:
branches: [master]
types: [opened, synchronize, reopened, closed]

Expand All @@ -18,6 +18,8 @@ jobs:
steps:
- name: Checkout 🛎️
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Install and Build 🔧
env:
Expand Down Expand Up @@ -46,7 +48,7 @@ jobs:
preview:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
if: github.event_name == 'pull_request_target'
permissions:
contents: write
pull-requests: write
Expand All @@ -55,14 +57,14 @@ jobs:
uses: actions/checkout@v6

- name: Download pre-built site
if: github.event_name == 'pull_request'
if: github.event_name == 'pull_request_target'
uses: actions/download-artifact@v4
with:
name: public-dir
path: .

- name: Extract site
if: github.event_name == 'pull_request'
if: github.event_name == 'pull_request_target'
run: |
unzip -q public-dir.zip
# Ensure the extracted folder has the static files in a 'public' dir for the action
Expand All @@ -73,14 +75,14 @@ jobs:
fi

- name: Deploy Preview
if: github.event_name == 'pull_request' && github.event.action != 'closed'
if: github.event_name == 'pull_request_target' && github.event.action != 'closed'
uses: rossjrw/pr-preview-action@v1.6.3
with:
source-dir: public
token: ${{ secrets.GITHUB_TOKEN }}

- name: Remove Preview on Close
if: github.event_name == 'pull_request' && github.event.action == 'closed'
if: github.event_name == 'pull_request_target' && github.event.action == 'closed'
uses: rossjrw/pr-preview-action@v1.6.3
with:
source-dir: public
Expand Down
Loading