Skip to content
Closed
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
24 changes: 8 additions & 16 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_target:
pull_request:
branches: [master]
types: [opened, synchronize, reopened, closed]

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

- name: Install and Build 🔧
env:
PATH_PREFIX: /recognition/preview-badges/pr-${{ github.event.pull_request.number }}
PATH_PREFIX: /recognition/pr-preview/pr-${{ github.event.pull_request.number }}
run: |
npm install
node -v
npm run build -- --prefix-paths

- name: Remove CNAME file
run: |
rm -f public/CNAME

- name: Broken Link Check 🔗
uses: technote-space/broken-link-checker-action@v2
with:
Expand All @@ -52,7 +46,7 @@ jobs:
preview:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'pull_request_target'
if: github.event_name == 'pull_request'
permissions:
contents: write
pull-requests: write
Expand All @@ -61,14 +55,14 @@ jobs:
uses: actions/checkout@v6

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

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

- name: Deploy Preview
if: github.event_name == 'pull_request_target' && github.event.action != 'closed'
if: github.event_name == 'pull_request' && github.event.action != 'closed'
uses: rossjrw/[email protected]
with:
source-dir: public
umbrella-dir: preview-badges
token: ${{ secrets.GITHUB_TOKEN }}

- name: Remove Preview on Close
if: github.event_name == 'pull_request_target' && github.event.action == 'closed'
if: github.event_name == 'pull_request' && github.event.action == 'closed'
uses: rossjrw/[email protected]
with:
source-dir: public
umbrella-dir: preview-badges
remove: true
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
Loading