Skip to content

reinit preview branches from main #1338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2025
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
9 changes: 6 additions & 3 deletions .github/workflows/docs-preview-create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,18 @@ jobs:
- 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: Checkout
run: git fetch origin ${{ env.BRANCH }} && git checkout ${{ env.BRANCH }} || git checkout -b ${{ env.BRANCH }}
- 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 }}"
Expand All @@ -59,7 +62,7 @@ jobs:

- name: Push
id: push
run: git add -A && git commit -m "sync docs" && git push -u origin ${{ env.BRANCH }}
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
Expand Down