Skip to content

Commit 65111fc

Browse files
committed
ci: add Cloudflare Pages preview for docs PRs
Deploys a per-PR preview of the TypeDoc site to Cloudflare Pages project mcp-ext-apps-docs-preview when docs, src JSDoc, README, or typedoc config change. Uses the shared modelcontextprotocol/actions composite action that injects noindex headers, posts a sticky PR comment with preview URLs, and cleans up deployments on PR close. Fork PRs are skipped (no secret access).
1 parent 3097608 commit 65111fc

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

.github/workflows/docs-preview.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Docs Preview
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, closed]
6+
paths:
7+
- "docs/**"
8+
- "src/**"
9+
- "README.md"
10+
- "typedoc.config.mjs"
11+
- "scripts/typedoc-*.mjs"
12+
- ".github/workflows/docs-preview.yml"
13+
14+
permissions:
15+
contents: read
16+
pull-requests: write
17+
18+
concurrency:
19+
group: docs-preview-${{ github.event.pull_request.number }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
build-and-deploy:
24+
# Refuse to run for fork PRs — forks do not have access to the Cloudflare
25+
# secrets, so deploys would fail anyway.
26+
if: >-
27+
github.event.action != 'closed' &&
28+
github.event.pull_request.head.repo.full_name == github.repository
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v6
32+
33+
- uses: actions/setup-node@v6
34+
with:
35+
node-version: "22"
36+
cache: npm
37+
38+
- run: npm ci
39+
40+
- run: npm run build
41+
42+
- run: npm run docs
43+
44+
- name: Deploy preview
45+
uses: modelcontextprotocol/actions/cloudflare-pages-preview/deploy@main
46+
with:
47+
directory: docs
48+
project-name: mcp-ext-apps-docs-preview
49+
api-token: ${{ secrets.CF_PAGES_PREVIEW_API_TOKEN }}
50+
account-id: ${{ secrets.CF_PAGES_PREVIEW_ACCOUNT_ID }}
51+
comment-title: "📖 Docs Preview Deployed"
52+
comment-marker: "<!-- docs-preview-comment -->"
53+
54+
cleanup:
55+
if: >-
56+
github.event.action == 'closed' &&
57+
github.event.pull_request.head.repo.full_name == github.repository
58+
runs-on: ubuntu-latest
59+
steps:
60+
- uses: modelcontextprotocol/actions/cloudflare-pages-preview/cleanup@main
61+
with:
62+
project-name: mcp-ext-apps-docs-preview
63+
api-token: ${{ secrets.CF_PAGES_PREVIEW_API_TOKEN }}
64+
account-id: ${{ secrets.CF_PAGES_PREVIEW_ACCOUNT_ID }}
65+
comment-marker: "<!-- docs-preview-comment -->"

0 commit comments

Comments
 (0)