mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-17 05:31:16 +08:00
Fork PRs receive a read-only GITHUB_TOKEN that cannot push to gh-pages, causing the deploy step to fail with a 403. Skip the deploy for fork PRs while still running the docs build to validate changes compile cleanly.
59 lines
1.5 KiB
YAML
59 lines
1.5 KiB
YAML
name: Docs PR Preview
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
types: [opened, reopened, synchronize, closed]
|
|
paths:
|
|
- "docs/**"
|
|
|
|
concurrency:
|
|
group: preview-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
packages: read
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
env:
|
|
MISE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
jobs:
|
|
preview:
|
|
runs-on: build-arm64
|
|
container:
|
|
image: ghcr.io/nvidia/openshell/ci:latest
|
|
credentials:
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install tools
|
|
run: mise install
|
|
|
|
- name: Build documentation
|
|
if: github.event.action != 'closed'
|
|
run: mise run docs:build:strict
|
|
|
|
- name: Delete unnecessary files
|
|
if: github.event.action != 'closed'
|
|
run: |
|
|
find _build -name .doctrees -prune -exec rm -rf {} \;
|
|
find _build -name .buildinfo -exec rm {} \;
|
|
|
|
- name: Deploy preview
|
|
if: github.event.pull_request.head.repo.full_name == github.repository
|
|
uses: rossjrw/pr-preview-action@v1
|
|
with:
|
|
source-dir: ./_build/docs/
|
|
preview-branch: gh-pages
|
|
umbrella-dir: pr-preview
|
|
action: auto
|