Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion .github/workflows/build-docs-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build Docs Preview
on:
pull_request:
branches: [master]
types: [opened, synchronize, reopened]
types: [opened, synchronize, reopened, closed]
paths:
- 'content/**'
- 'assets/**'
Expand Down Expand Up @@ -38,27 +38,32 @@ jobs:
# plus objects.githubusercontent.com must be in allowed-endpoints or the
# build dies at module resolution.
- name: Harden Runner
if: github.event.action != 'closed'
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit

- name: Checkout PR
if: github.event.action != 'closed'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
submodules: recursive

- name: Setup Go
if: github.event.action != 'closed'
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod

- name: Setup Node
if: github.event.action != 'closed'
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "22"

- name: Install dependencies
if: github.event.action != 'closed'
run: |
if [ -f package-lock.json ] || [ -f npm-shrinkwrap.json ]; then
npm ci
Expand All @@ -67,6 +72,7 @@ jobs:
fi

- name: Build PR preview
if: github.event.action != 'closed'
env:
HUGO_PREVIEW: "true"
BASE_URL: /pr-preview/pr-${{ github.event.pull_request.number }}/
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/deploy-docs-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
run: |
ACTION=$(head -n1 temp-artifact/pr/action 2>/dev/null | tr -d '[:space:]')
case "$ACTION" in
opened|reopened|synchronize) ;;
opened|reopened|synchronize|closed) ;;
*) echo "::error::invalid or missing action: '$ACTION'"; exit 1 ;;
esac

Expand All @@ -72,7 +72,7 @@ jobs:
umbrella-dir: pr-preview
pr-number: ${{ steps.meta.outputs.pr_number }}
pages-base-url: docs.layer5.io
action: deploy
action: ${{ steps.meta.outputs.action == 'closed' && 'remove' || 'deploy' }}
wait-for-pages-deployment: false
comment: false

Expand All @@ -82,8 +82,9 @@ jobs:
header: pr-preview
number: ${{ steps.meta.outputs.pr_number }}
message: |
🚀 Preview deployment: https://docs.layer5.io/pr-preview/pr-${{ steps.meta.outputs.pr_number }}/
> *Note: Preview may take a moment (GitHub Pages deployment in progress). Please wait and refresh. Track deployment [here](https://github.com/${{ github.repository }}/actions/workflows/pages/pages-build-deployment)*
${{ steps.meta.outputs.action == 'closed' && 'Preview removed because the pull request was closed.'
|| format('🚀 Preview deployment: https://docs.layer5.io/pr-preview/pr-{0}/
> *Note: Preview may take a moment (GitHub Pages deployment in progress). Please wait and refresh. Track deployment [here](https://github.com/{1}/actions/workflows/pages/pages-build-deployment)*', steps.meta.outputs.pr_number, github.repository) }}

prune:
# Both jobs push to gh-pages, but only prune retries a lost race, so deploy
Expand Down
Loading