Skip to content

Docs preview create #5700

Docs preview create

Docs preview create #5700

name: Docs preview create
on:
workflow_dispatch:
inputs:
repo:
description: 'Repository name (not fully-qualified, eg. `svelte` or `kit`)'
required: true
type: string
pr:
description: 'PR number'
required: true
type: string
owner:
description: 'Owner (eg. sveltejs)'
required: true
type: string
branch:
description: 'Branch (eg. my-feature-branch)'
required: true
type: string
permissions:
contents: write
env:
BRANCH: preview-${{ inputs.repo }}-${{ inputs.pr }}
jobs:
Sync:
name: Sync
runs-on: ubuntu-latest
concurrency:
group: preview-${{ inputs.repo }}-${{ inputs.pr }} # can't reference env here
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}
ref: main # Explicitly checkout main branch first
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Create or reset branch from main
run: |
git fetch origin
git checkout -B ${{ env.BRANCH }} # Force create/reset branch based on current main
- name: Sync
run: cd apps/svelte.dev && pnpm sync-docs --owner="${{ inputs.owner }}" -p "${{ inputs.repo }}#${{ inputs.branch }}"
- name: Configure Git
run: |
git config --global user.name "GitHub Actions Bot"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Push
id: push
run: git add -A && git commit -m "sync docs" && git push -u origin ${{ env.BRANCH }} --force
- name: Request preview comment
uses: peter-evans/repository-dispatch@v3
with:
event-type: 'request-preview-comment'
client-payload: |-
{
"repo": "${{ inputs.repo }}",
"pr": "${{ inputs.pr }}"
}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy