name: Docs Preview on: pull_request: types: [opened, synchronize, reopened, closed] paths: - "docs/**" - "src/**" - "README.md" - "typedoc.config.mjs" - "scripts/typedoc-*.mjs" - ".github/workflows/docs-preview.yml" permissions: contents: read pull-requests: write concurrency: group: docs-preview-${{ github.event.pull_request.number }} cancel-in-progress: true jobs: build-and-deploy: # Refuse to run for fork PRs — forks do not have access to the Cloudflare # secrets, so deploys would fail anyway. if: >- github.event.action != 'closed' && github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - uses: actions/setup-node@v6 with: node-version: "22" cache: npm - run: npm ci - run: npm run build - run: npm run docs - name: Deploy preview uses: modelcontextprotocol/actions/cloudflare-pages-preview/deploy@main with: directory: docs project-name: mcp-ext-apps-docs-preview api-token: ${{ secrets.CF_PAGES_PREVIEW_API_TOKEN }} account-id: ${{ secrets.CF_PAGES_PREVIEW_ACCOUNT_ID }} comment-title: "📖 Docs Preview Deployed" comment-marker: "" cleanup: if: >- github.event.action == 'closed' && github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest steps: - uses: modelcontextprotocol/actions/cloudflare-pages-preview/cleanup@main with: project-name: mcp-ext-apps-docs-preview api-token: ${{ secrets.CF_PAGES_PREVIEW_API_TOKEN }} account-id: ${{ secrets.CF_PAGES_PREVIEW_ACCOUNT_ID }} comment-marker: ""