Skip to content

Commit 2a5cd30

Browse files
authored
docs: keep fork preview setup with the workflow
1 parent 770b234 commit 2a5cd30

2 files changed

Lines changed: 7 additions & 35 deletions

File tree

.github/workflows/deploy-docs-fork-preview.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ name: Deploy Docs Fork Preview
33
# Fork PRs cannot receive deployment credentials. This workflow runs from
44
# the default branch, validates the originating workflow and current PR,
55
# and uploads only static assets. It never checks out or executes fork code.
6+
# This file must be on main before workflow_run can trigger it.
7+
#
8+
# Maintainer setup: restrict the docs-preview environment to main. Add the
9+
# CLOUDFLARE_ACCOUNT_ID variable and CLOUDFLARE_API_TOKEN secret there. Scope
10+
# the token to the Worker account with Workers Scripts: Edit permission.
11+
# Enable Preview URLs for viteplus-dev on voidzero-docs.workers.dev.
612
on: # zizmor: ignore[dangerous-triggers]
713
workflow_run:
814
workflows: ['Build Docs Fork Preview']
@@ -111,7 +117,7 @@ jobs:
111117
WRANGLER_OUTPUT_FILE_PATH: ${{ runner.temp }}/docs-preview-upload.jsonl
112118
run: |
113119
if [[ -z "$CLOUDFLARE_ACCOUNT_ID" || -z "$CLOUDFLARE_API_TOKEN" ]]; then
114-
echo '::error::Configure CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in the docs-preview environment. See CONTRIBUTING.md.'
120+
echo '::error::Configure the CLOUDFLARE_ACCOUNT_ID variable and CLOUDFLARE_API_TOKEN secret in the docs-preview environment.'
115121
exit 1
116122
fi
117123
"$RUNNER_TEMP/docs-preview-tools/node_modules/.bin/wrangler" versions upload \

CONTRIBUTING.md

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -159,40 +159,6 @@ UPDATE_SNAPSHOTS=1 just snapshot-test create
159159

160160
The full case/step/interaction reference (including the `vpt` helper tool and milestone conventions for interactive tests) lives in `crates/vp_cli_snapshots/tests/cli_snapshots/README.md`; the design rationale is in `rfcs/interactive-snapshot-tests.md`.
161161

162-
## Documentation previews from forks
163-
164-
Documentation PRs from forks receive a Cloudflare preview from the
165-
`Build Docs Fork Preview` and `Deploy Docs Fork Preview` workflows. The build
166-
runs without deployment credentials. The deployment workflow uses code from
167-
the default branch and uploads the static build artifact to `viteplus-dev`.
168-
It checks the source repository, branch, and current PR commit before upload.
169-
The PR alias stays the same across updates to a PR.
170-
171-
Repository maintainers must configure the GitHub environment `docs-preview`:
172-
173-
- Set the environment variable `CLOUDFLARE_ACCOUNT_ID` to the account that owns
174-
`viteplus-dev`.
175-
- Add the environment secret `CLOUDFLARE_API_TOKEN` with permission to upload
176-
Worker versions to that account. Use the narrowest available token scope.
177-
- Enable Preview URLs for `viteplus-dev` in Cloudflare. The expected Workers
178-
subdomain is `voidzero-docs.workers.dev`.
179-
180-
The deployment workflow must be on `main` before GitHub can trigger it through
181-
`workflow_run`. After setup, push a documentation change to an open fork PR.
182-
GitHub may require approval for the contributor's first workflow run. A
183-
successful deployment adds or updates a comment on the original PR. The comment
184-
links to a fixed Worker version for the stated commit. It also includes the PR
185-
alias, such as `https://pr-2684-viteplus-dev.voidzero-docs.workers.dev`, which can
186-
point to a later upload. `wrangler versions upload` does not promote the version
187-
to production.
188-
189-
Same-repository PRs continue to use the existing preview integrations. To test
190-
the fork preview helpers locally, run:
191-
192-
```bash
193-
node --test .github/scripts/__tests__/docs-fork-preview.mjs
194-
```
195-
196162
## Submitting Pull Requests
197163

198164
Prioritize stacked pull requests when your work splits into reviewable layers, for example a refactor PR with the feature PR that depends on it stacked on top. Reviewers handle a stack of small PRs faster than one large PR, and each layer merges on its own.

0 commit comments

Comments
 (0)