fix(diagnostics): move event preflight codes off AB4840–AB4841 (#618 follow-up) #962
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Docs | |
| # Validates the Rspress documentation site (website/) on every pull request | |
| # and push to main, and deploys website/doc_build to GitHub Pages from main | |
| # (on push, or on a manual dispatch of the main branch). | |
| # | |
| # No `paths:` filter on purpose: package-source changes can break TypeDoc | |
| # generation and the generated reference pages without touching website/**, | |
| # and a path-filtered workflow can never safely become a required check. | |
| # Website-only PRs skip the heavy jobs in ci.yml (scripts/classify-docs-only.mjs | |
| # treats website/** as docs-only) because this workflow covers them. | |
| # | |
| # One-time prerequisite: repository Settings -> Pages -> Source must be | |
| # "GitHub Actions" (REST: build_type=workflow), or deploy-pages fails. | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| # "Docs site" is a required check on main, so it must also report on merge | |
| # queue entries (see the merge_group note in ci.yml; dormant until the | |
| # repository is organization-owned). Queue runs build only: the deploy | |
| # steps stay gated on a push or dispatch of main itself. | |
| merge_group: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| # PR pushes cancel the superseded run of the same PR. Every run that can | |
| # deploy (push or manual dispatch on main) shares one non-cancelling group so | |
| # build-and-deploy runs execute in order and an older, slower build can never | |
| # deploy over a newer one (GitHub keeps at most one pending run per group, so | |
| # a superseded pending build is dropped, never reordered). Dispatches on other | |
| # refs and merge-queue entries (ref gh-readonly-queue/main/...) get SHA-keyed | |
| # groups. | |
| concurrency: | |
| group: docs-${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && 'main' || github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| build: | |
| name: Docs site (Node 22.19) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 25 | |
| # Third-party actions are pinned to full commit SHAs (a moving `vN` tag | |
| # can be repointed at unreviewed code); the trailing comment names the | |
| # release Dependabot keeps in step. | |
| steps: | |
| # Full history, blobless: `sitemap.xml` `lastmod` comes from | |
| # `git log -1 -- <source>` (website/plugins/sitemap-lastmod.ts), which | |
| # needs every commit and tree but no old file contents. On a shallow | |
| # clone the plugin omits `lastmod` rather than dating every page today. | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| filter: blob:none | |
| - uses: ./.github/actions/setup-workspace | |
| with: | |
| node-version: 22.19.0 | |
| # Website-only PRs skip every ci.yml job that lints, so lint here too. | |
| - run: pnpm lint | |
| # Typecheck the site config, run the locale-drift and diagnostics- | |
| # coverage checks (website/scripts), build with the persistent Rspack | |
| # cache off, then walk the emitted HTML for dead links and anchors. | |
| # Rspress's own dead-link, dead-anchor, dead-image, and language-parity | |
| # checks fail the build if TypeDoc or the generated reference pages are | |
| # missing, since the authored pages link to them. | |
| - run: pnpm docs:site:build | |
| - name: Upload Pages artifact | |
| if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') | |
| uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 | |
| with: | |
| path: website/doc_build | |
| deploy: | |
| name: Deploy to GitHub Pages | |
| needs: build | |
| if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| # Never cancel an in-flight Pages deployment. | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| steps: | |
| # Re-running an older main run (or any path that bypasses the queue | |
| # above) must not publish a stale site: only deploy when this commit is | |
| # still the head of main. | |
| - name: Confirm this commit is still the head of main | |
| id: head | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| head="$(gh api "repos/${GITHUB_REPOSITORY}/branches/main" --jq .commit.sha)" | |
| if [ "$head" = "$GITHUB_SHA" ]; then | |
| echo "deploy=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "deploy=false" >> "$GITHUB_OUTPUT" | |
| echo "Skipped deploy: main moved to ${head}; this run built ${GITHUB_SHA}." >> "$GITHUB_STEP_SUMMARY" | |
| fi | |
| - if: steps.head.outputs.deploy == 'true' | |
| uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0 | |
| - if: steps.head.outputs.deploy == 'true' | |
| id: deployment | |
| uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1 |