Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
e8fcaeb
Build/Test Tools: Add Code Reference preview foundations
sirreal Aug 9, 2026
a80f03b
Build/Test Tools: Resolve Code Reference build inputs
sirreal Aug 9, 2026
4e27b0b
Build/Test Tools: Pin Code Reference build tools
sirreal Aug 9, 2026
62dc257
Build/Test Tools: Cache the Code Reference site base
sirreal Aug 9, 2026
b97d59f
Build/Test Tools: Generate Code Reference parser data
sirreal Aug 9, 2026
173b818
Build/Test Tools: Package Code Reference snapshots
sirreal Aug 9, 2026
2a8dc89
Build/Test Tools: Add Code Reference runtime policy
sirreal Aug 9, 2026
ca62018
Build/Test Tools: Validate Code Reference snapshots
sirreal Aug 9, 2026
dea4904
Build/Test Tools: Orchestrate Code Reference previews
sirreal Aug 9, 2026
b1cdc81
Build/Test Tools: Stop executing preview source during import
sirreal Aug 9, 2026
d1fd8a0
Build/Test Tools: Add the Code Reference pull request build
sirreal Aug 9, 2026
13e0aab
Build/Test Tools: Validate Code Reference publication handoffs
sirreal Aug 9, 2026
976908d
Build/Test Tools: Add the Code Reference publisher transport
sirreal Aug 9, 2026
02c2cd2
Build/Test Tools: Add published preview validation
sirreal Aug 9, 2026
02155cc
Build/Test Tools: Publish PR snapshots transactionally
sirreal Aug 9, 2026
d2a18d6
Build/Test Tools: Test PR publication transactions
sirreal Aug 9, 2026
7242c10
Build/Test Tools: Publish Code Reference PR snapshots
sirreal Aug 9, 2026
36f1339
Build/Test Tools: Add PR cache cleanup transport
sirreal Aug 9, 2026
744e374
Build/Test Tools: Manage Code Reference PR lifecycle
sirreal Aug 9, 2026
785e45c
Build/Test Tools: Activate Code Reference PR lifecycle
sirreal Aug 9, 2026
60970c1
Build/Test Tools: Close PR lifecycle races
sirreal Aug 9, 2026
15f2237
Build/Test Tools: Bind stale docs comments to exact state
sirreal Aug 9, 2026
4c44ebd
Build/Test Tools: Define trunk docs publication identity
sirreal Aug 9, 2026
92db866
Build/Test Tools: Add trunk publication transport
sirreal Aug 9, 2026
d67ad63
Build/Test Tools: Publish trunk docs transactionally
sirreal Aug 9, 2026
00c09d5
Build/Test Tools: Test trunk publication recovery
sirreal Aug 9, 2026
43f4b57
Build/Test Tools: Run docs preview on trunk pushes
sirreal Aug 9, 2026
cc4e878
Build/Test Tools: Document Code Reference previews
sirreal Aug 9, 2026
000b7ff
Build/Test Tools: Validate the stable docs pointer
sirreal Aug 9, 2026
77f1aaf
Build/Test Tools: Fix docs workflow runner paths
sirreal Aug 9, 2026
2009084
Build/Test Tools: Apply Core style to docs harness
sirreal Aug 9, 2026
2b1d7cb
Build/Test Tools: Apply Core style to docs PHP
sirreal Aug 9, 2026
65fa146
Build/Test Tools: Preserve docs preview comment state
sirreal Aug 9, 2026
7cc5076
Build/Test Tools: Preserve the last docs preview link
sirreal Aug 9, 2026
6fa106a
Docs: Point the staging preview at staging
sirreal Aug 9, 2026
a19ceee
Build/Test Tools: Let Playground choose validation workers
sirreal Aug 9, 2026
62feb2a
Build/Test Tools: Use six Playground snapshot workers
sirreal Aug 9, 2026
37384b8
Build/Test Tools: Serialize Playground snapshot builds
sirreal Aug 9, 2026
3317f97
Build/Test Tools: Preserve ambiguous trunk assets
sirreal Aug 9, 2026
c34eec0
Docs: Add a staging preview fixture
sirreal Aug 9, 2026
6ead3c5
Docs: Advance the staging preview fixture
sirreal Aug 9, 2026
b8059b0
Build/Test Tools: Allow staging fork documentation builds
sirreal Aug 10, 2026
7670d3b
Build/Test Tools: Enforce fork preview validation
sirreal Aug 10, 2026
8c4df68
Build/Test Tools: Report nested publisher failures
sirreal Aug 10, 2026
6f72a9b
Build/Test Tools: Grant PR publisher write access
sirreal Aug 10, 2026
95bcd71
Build/Test Tools: Break the staging publication path
sirreal Aug 10, 2026
65ef19f
Build/Test Tools: Restore the staging publication path
sirreal Aug 10, 2026
d5074d8
Build/Test Tools: Preserve stale docs preview links
sirreal Aug 10, 2026
2e0f134
Merge branch 'WordPress:trunk' into trunk
sirreal Aug 26, 2026
4277884
Staging: update the Code Reference preview pipeline to the simplified…
sirreal Sep 7, 2026
2694113
Staging: probe sentence in the wp_parse_args docblock
sirreal Sep 7, 2026
f0ad540
Staging: touch a test file to exercise the tests workflow
sirreal Sep 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
paths:
.github/workflows/docs-playground-preview-publish.yml:
ignore:
# actionlint 1.7.11 predates GitHub's concurrency queue property.
- 'unexpected key "queue" for "concurrency" section'
.github/workflows/docs-playground-preview-lifecycle.yml:
ignore:
- 'unexpected key "queue" for "concurrency" section'
1 change: 1 addition & 0 deletions .github/docs-playground-preview/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.20.2
80 changes: 80 additions & 0 deletions .github/docs-playground-preview/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Code Reference Playground preview

This directory holds the pinned inputs for the WordPress Core Code Reference preview: the dependency manifest, the Node version, and the npm tools the build installs. The implementation is in `.github/scripts/docs-playground-preview`.

A preview is the Core Code Reference built from PHPDoc at one commit, imported into a wporg-developer site and packaged as a WordPress Playground snapshot. Adding the `docs-preview` label to a pull request against `trunk` builds one and posts a link in a single comment on the pull request. Every push to `trunk` refreshes the preview that the repository `README.md` links.

Pull request source is parsed, never executed. The build job runs with `contents: read` and nothing else; only default-branch code, in a separate workflow, has the write access to publish. A pull request build may warm the build cache because GitHub scopes an entry written from a pull request ref to that ref, where it cannot replace the entry the default branch reads.

## What runs where

| Workflow | Trigger | What it does |
| --- | --- | --- |
| Build | The `docs-preview` label is added, a labeled pull request is pushed to, or `trunk` is pushed to | Builds and validates the snapshot and uploads it as an artifact kept for one day. A first attempt on a pull request reuses a published snapshot for the same commit instead of building one. |
| Publish | The build workflow finishes | Uploads the snapshot to the release. For a pull request it removes the label and updates the comment; for `trunk` it moves the stable Blueprint. |
| Lifecycle | A pull request against `trunk` is pushed to or closed | Marks the comment stale when the pull request is no longer labeled. On close, deletes the pull request's assets and caches and marks the comment expired. |
| Tests | A change under `.github/scripts/docs-playground-preview` or this directory | Runs the script tests and type checking. |

The comment is identified by the marker `<!-- code-reference-docs-preview -->` and is separate from the general Core Playground comment. It is created once and updated in place.

## Local build

```sh
npm --prefix .github/docs-playground-preview run build
```

Needs `git`, `node` at the version in `.nvmrc`, `php` 8.4, `composer` and `zip` on `PATH`. The command installs the pinned npm tools itself. It then takes the repository and commit from the checkout, resolves the current WordPress beta, builds or restores the site base, parses the PHP under `src`, imports the Code Reference, packages the snapshot and runs the same validation as CI. Everything is written below `.cache/docs-playground-preview`: the snapshot and its `build.json` in `output`, the cached base in `cache`.

The first build clones and builds the six pinned repositories and takes a long time. Later builds restore that base from the cache directory while the cache key is unchanged.

CI runs the same command twice. `--resolve-only` writes the cache key and directory for the cache restore step, plus the resolved inputs the second run reads back, so both runs agree on the WordPress version. The build run adds the source identity, `--source-repository`, `--source-sha` and `--run-url`, which appear in the snapshot's provenance banner. Both runs write into `--handoff`, the directory the publish job downloads; a failure in either run is reported through it.

## Tests and type checking

```sh
npm --prefix .github/docs-playground-preview test
npm --prefix .github/docs-playground-preview run typecheck
```

The `Code Reference Playground Preview Tests` workflow runs both. Type checking runs even when the tests fail, so one run reports both.

## Updating pins

`dependencies.json` pins each upstream repository to a full commit, and the build refuses anything else, because a branch or a tag would let the base change under a cache key that stays the same. To move a pin, change its commit, run a local build, then exercise a cold and a warm build in the staging repository.

The other pins live where the tool that reads them looks:

- **Node:** `.nvmrc`. All seven `setup-node` steps read it. Update `engines.node` and `@types/node` in `package.json` to match.
- **npm packages** (`@wp-playground/cli`, `@wordpress/scripts`, `yarn`): `package.json`, then regenerate `package-lock.json`.
- **PHP:** two versions that must agree. `playground.phpVersion` in `dependencies.json` is the PHP inside the snapshot; `php-version` in both `setup-php` steps of the build workflow is the PHP that runs phpdoc-parser.
- **Composer:** the `tools: composer:` version in both `setup-php` steps of the build workflow.
- **A GitHub Action:** its full commit SHA and the version comment beside it, in every workflow that uses it.

The cache key covers every file under this directory and under `.github/scripts/docs-playground-preview`, apart from `node_modules`, the type-check output and the tests, plus the resolved WordPress version and the runner image. Editing any of them builds a new base, whether or not that file shapes what the base contains: rebuilding for nothing costs one build, while a file left out of the key would be served from a stale cache forever. Increment `cacheSchemaVersion` to force a new base when nothing in the repository changed.

`validation.minimumSymbols`, `validation.routes` and `validation.search` in `dependencies.json` are what the finished snapshot is checked against. A route renamed upstream is changed there.

## Repository variables

The workflows run in `WordPress/wordpress-develop`. In `sirreal/wordpress-develop` they run only while the Actions variable `DOCS_PREVIEW_STAGING` is exactly `true`. Every job that writes anything tests that variable, and `assertDeploymentEnabled()` tests it again inside the publish and lifecycle scripts. To disable staging, delete the variable or give it any other value.

The pull request build job is the exception: it is allowlisted by repository name and does not consult the variable, because GitHub does not expose the base repository's Actions variables to a fork's `pull_request` run. That job cannot publish, comment, label or delete anything. With staging off, labeling a pull request there costs a read-only build and a one-day artifact. Other forks run nothing.

`DOCS_PREVIEW_ENFORCE` decides what a validation failure costs. Unset, the failures are reported as warnings, the comment says the attempt failed, and the preview published earlier stays linked. Set to exactly `true`, the build fails, and so does the publisher after it has reported the failure. Set either variable under **Settings > Secrets and variables > Actions > Variables**.

## Published assets

Snapshots are assets on the `code-reference-playground-preview` prerelease, each beside a JSON metadata asset with the same stem. The publisher names them after its own workflow run, so no build can name another pull request's asset.

- `code-reference-pr-<number>-<sha>-<run>-<attempt>.zip`. Publishing deletes every other asset of that pull request. Closing the pull request deletes them all.
- `code-reference-trunk-<sha>-<run>-<attempt>.zip`. The Blueprint `code-reference-trunk.json`, committed to the `docs-preview-code-reference` branch, names the newest one, and the repository `README.md` links that file through the Playground CORS proxy. The two newest generations are kept, because a cached copy of the Blueprint can name the previous snapshot for minutes after the pointer moves.

A snapshot over 100 MiB (104857600 bytes) fails the build, and the publisher checks the size again before uploading.

## When something fails

The comment's status line is one of Ready, Latest attempt failed, Stale or Expired. A failed attempt keeps the link to the last preview that worked.

- Read the run linked from the comment. Validation failures are also `::warning::` annotations on the build job.
- Publishing removes the label, so a rebuild means adding `docs-preview` again. A push while the preview is publishing keeps the label, because that push already started a build of its own. **Re-run all jobs** on the original build rebuilds the same commit and skips the same-commit reuse.
- For `trunk`, re-run the newest trunk build or push another commit. The next successful publication moves the pointer and prunes older assets. Do not delete the `docs-preview-code-reference` branch or the snapshot it names.
78 changes: 78 additions & 0 deletions .github/docs-playground-preview/dependencies.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"cacheSchemaVersion": 1,
"playground": {
"phpVersion": "8.4"
},
"repositories": {
"phpdocParser": {
"repository": "WordPress/phpdoc-parser",
"commit": "1156399efccafd344818fa3b566ce5beafdc655e",
"path": "."
},
"wporgDeveloper": {
"repository": "WordPress/wporg-developer",
"commit": "f2b6b9c1fe788fb4a5441a296b591f6dff540607",
"path": "source/wp-content/themes/wporg-developer-2023"
},
"wporgParent2021": {
"repository": "WordPress/wporg-parent-2021",
"commit": "3b61f284dcc600dc5ad500e34d56108351909d32",
"path": "source/wp-content/themes/wporg-parent-2021"
},
"wporgMuPlugins": {
"repository": "WordPress/wporg-mu-plugins",
"commit": "f37f522a0ed78b64748fa0b390e58e9f74de32ea",
"path": "mu-plugins"
},
"postsToPosts": {
"repository": "scribu/wp-posts-to-posts",
"commit": "d2f297dbe257a09438da6ffe22c9a876acb7b49b",
"path": "."
},
"codeSyntaxBlock": {
"repository": "mkaz/code-syntax-block",
"commit": "7179d747eef70ca8760cf5e0c04d3877158fa350",
"path": "."
}
},
"validation": {
"minimumSymbols": {
"classes": 400,
"methods": 3000,
"functions": 1800,
"hooks": 600,
"filters": 1000
},
"routes": {
"index": {
"path": "/reference/",
"expectedText": "Code Reference"
},
"class": {
"path": "/reference/classes/wp_html_tag_processor/",
"expectedText": "WP_HTML_Tag_Processor"
},
"method": {
"path": "/reference/classes/wp_html_tag_processor/next_tag/",
"expectedText": "next_tag"
},
"function": {
"path": "/reference/functions/wp_parse_args/",
"expectedText": "wp_parse_args"
},
"hook": {
"path": "/reference/hooks/init/",
"expectedText": "init"
},
"filter": {
"path": "/reference/hooks/the_content/",
"expectedText": "the_content"
}
},
"search": {
"path": "/?s=wp_parse_args&post_type=wp-parser-function",
"expectedText": "wp_parse_args",
"expectedPath": "/reference/functions/wp_parse_args/"
}
}
}
Loading
Loading