Skip to content

PR Preview

PR Preview #21

Workflow file for this run

name: PR Preview
on:
workflow_run:
workflows: ["PR Build"]
types:
- completed
permissions:
pull-requests: write # allow surge-preview to create/update PR comments
concurrency:
group: ${{ github.workflow }}-${{ github.event.workflow_run.id }}
cancel-in-progress: true
jobs:
preview:
# environment: SurgePreviewPR
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/download-artifact@v4
with:
github-token: ${{ github.token }}
run-id: ${{ github.event.workflow_run.id }}
# Otherwise preview URL includes subfolder (https://relativeorbit-sarbook-preview-pr-3.surge.sh/html/index.html)
path: ./
- name: List directory contents
run: |
pwd
ls -lh
ls *
du -sh *
- name: Manage Surge deployment
id: preview_step
uses: afc163/surge-preview@v1
with:
surge_token: ${{ secrets.SURGE_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
build: echo 'Uploading html/ folder contents to Surge.sh...'
dist: ./
failOnError: true
- name: Get the preview_url
run: echo "url => ${{ steps.preview_step.outputs.preview_url }}"