Keep the pinned WordPress corpus current automatically - #286
Open
sirreal wants to merge 1 commit into
Open
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #284 — retarget to
masterwhen that merges. The only new file is.github/workflows/corpus-pin-update.yml; the pin incorpus-diff.ymlis untouched here.What it does
Dependabot can't track WordPress core releases, so
WP_CORPUS_TAGwould quietly rot on whatever tag it was born with. Weekly (Mondays 05:43 UTC) and on demand, this workflow:https://api.wordpress.org/core/version-check/1.7/foroffers[0].current. That endpoint is canonical and already excludes betas and RCs, unlike a raw tag listing of WordPress/WordPress. The answer must match^[0-9]+\.[0-9]+(\.[0-9]+)?$or the job fails — an API hiccup must not become a garbage commit.corpus-diff.ymland compares. It bumps only when the published stable is strictly newer (sort -V), so a deliberate pin ahead of stable is never walked back, and only when the WordPress/WordPress mirror has actually tagged the release, so it can't open a PR whose corpus download would 404.git diff --numstatis exactly +1/-1. Anything else fails the job.bump-corpus-pin-<version>as a PR. Idempotent: if a PR for that branch already exists in any state — including closed, meaning a human declined the bump — it does nothing.Why a bump PR is trivial to review
A bump PR changes only the corpus input, never the parser. Its own corpus-diff run therefore parses the new corpus with an identical parser on both sides: 0 hunks by construction. Reviewing one is just checking that the corpus guards (file count, export size) still pass on the new tag. A non-zero diff on a bump PR would mean corpus-diff isn't comparing what it claims to.
Dependency you may have to flip
PR creation with the built-in
GITHUB_TOKENrequires Settings → Actions → General → Workflow permissions → "Allow GitHub Actions to create and approve pull requests". Many organizations disable it and the WordPress org may. If it's off, the branch still gets pushed and the "Open the bump PR" step fails with::error::naming that setting; the next run force-updates the branch and retries, so it self-heals once the setting is on. The alternative is a PAT withreposcope supplied asGH_TOKENfor that step. This is deliberately not swallowed: a silent no-op is how the corpus ends up three years stale with a green checkmark.Verification
Can't run cron locally, so each piece was run instead. The step scripts were extracted from the parsed YAML (so what ran is exactly what the workflow contains) and executed against a real copy of
corpus-diff.yml:Latest WordPress stable: 7.0.4.Already pinned to the latest stable; nothing to do→bump=false.bump=true current=6.8, rewrite produced exactly- WP_CORPUS_TAG: "6.8"/+ WP_CORPUS_TAG: "7.0.4", file length unchanged, no temp file left behind.bump=false: pin equals stable; pin ahead of stable (7.0.4 vs 7.0.1); version not tagged on the mirror yet.actionlint1.7.12: clean on both workflows.bash -n: clean on all four step scripts. YAML parses.🤖 Generated with Claude Code