Skip to content

Fix Plugin Check CI: WP-CLI token fix done; wp-env regression blocked upstream#766

Open
ilicfilip wants to merge 7 commits into
developfrom
filip/pin-setup-php-plugin-check
Open

Fix Plugin Check CI: WP-CLI token fix done; wp-env regression blocked upstream#766
ilicfilip wants to merge 7 commits into
developfrom
filip/pin-setup-php-plugin-check

Conversation

@ilicfilip
Copy link
Copy Markdown
Collaborator

@ilicfilip ilicfilip commented May 29, 2026

Status: token issue FIXED ✅ — wp-env startup BLOCKED on upstream bug ⚠️

This PR fixes the test (WordPress.org Plugin Check) job on develop. There were two sequential failures. The first is fixed and verified; the second is a confirmed upstream bug with a maintainer-tracked fix in progress. Waiting on upstream.


Part 1 — FIXED & verified: GitHub token rejected by WP-CLI's Composer

Symptom: wp package install wp-cli/dist-archive-command failed with:

Failed to get composer instance: Your github oauth token for github.com contains invalid characters: "***"

Root cause: GitHub's Actions token format is now ghs_<id>_<base64url-JWT> (contains hyphens). The Composer bundled inside the stable WP-CLI phar uses an old validation regex that rejects hyphens — composer#12076. The token reaches WP-CLI via COMPOSER_AUTH (exported globally by setup-php), which WP-CLI reads before GITHUB_TOKEN, so clearing GITHUB_TOKEN had no effect.

Fix (committed here): sudo -E $(which wp) cli update --nightly --yes before the install. The nightly WP-CLI bundles a Composer with relaxed token validation. sudo is needed because setup-php installs the phar to a root-owned path.

Verified in CI: Success: Updated WP-CLI to the latest nightly release.Success: Package installed.Success: Created progress-planner.zip. This part works — keep it.


Part 2 — BLOCKED upstream: wp-env silently fails to start in plugin-check-action

Symptom (current failure): after the token fix, the job fails later inside wordpress/plugin-check-action:

- Reading configuration.            ← wp-env exits 0 without starting Docker
✖ Environment not initialized. Run `wp-env start` first.

This is a known upstream bug — WordPress/plugin-check-action#579 (filed 2026-05-27), with the underlying fix tracked in WordPress/gutenberg#78762.

Root cause (per maintainers' bisection in #579): The action auto-generates a .wp-env.json that always includes plugin-check as a URL plugin (https://downloads.wordpress.org/plugin/plugin-check.zip). @wordpress/env's HTTP zip-download path silently exits 0 without starting Docker on the current runner image (Node 24.16 / libuv 1.52.1, interacting with wp-env's pinned got@^11.8.5). The maintainers explicitly ruled out the testsEnvironment dual-env path and the --update flag as triggers.

This is develop-only (no plugin-check.yml on main) and unrelated to the v1.9.1 sync. It is not fixable cleanly from our side without inlining the action's steps (the action force-reinstalls @wordpress/env itself, overriding any version pin we set — confirmed in this PR's commit history).

Decision: wait for upstream

The maintainers' preferred fix is to change plugin-check-action to stop putting plugin-check as a URL plugin (install it via wp-cli post-boot instead). Once that ships, bumping the action version will fix us with no workaround. We are waiting on that rather than maintaining an inlined-workaround copy of the action.

  • Immediate unblock workaround, if needed later: inline the action's steps and drop the URL-plugin entry, installing plugin-check via wp-cli after wp-env start — reference diff WordPress/performance#2496.

Next steps for whoever picks this up

  1. Watch plugin-check-action#579 / gutenberg#78762 for a released fix, then bump wordpress/plugin-check-action to the fixed tag.
  2. If CI needs unblocking before then, either apply the #2496-style inline workaround or set continue-on-error: true on the test job temporarily.

Commits in this PR

  • WP-CLI nightly update (+ sudo) — the working token fix, keep
  • @wordpress/env@11.5.0 pin attempt — does not hold (action re-installs latest); can be dropped
  • (earlier setup-php pin / unset GITHUB_TOKEN commits — superseded, ineffective)

Test plan

  • Token error resolved (wp package install succeeds)
  • wp-env environment starts — blocked on plugin-check-action#579

The Plugin Check job ("test") fails at `wp package install` with
"github oauth token contains invalid characters". The token is the
auto-injected GITHUB_TOKEN that setup-php hands to Composer; a behavior
change in the floating @v2 tag surfaced the rejection. Pin to a known
version to stabilize the job. Repo has no custom token secret, so this
is not a credentials issue.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

Test on Playground
Test this pull request on the Playground
or download the zip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

✅ Code Coverage Report

Metric Value
Total Coverage 31.62% 📉
Base Coverage 31.62%
Difference 📈 0.00%

⚠️ Coverage below recommended 40% threshold

🎉 Great job maintaining/improving code coverage!

ℹ️ About this report
  • All tests run in a single job with Xdebug coverage
  • Security tests excluded from coverage to prevent output issues
  • Coverage calculated from line coverage percentages

The setup-php pin did not fix the Plugin Check job: the token rejection
("invalid characters") comes from wp-cli's bundled Composer, not setup-php.
setup-php exports the Actions GITHUB_TOKEN for Composer, and wp-cli's
Composer refuses its format. Clear the token env for just this step so the
single public-package fetch runs unauthenticated (well within rate limits).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ilicfilip ilicfilip changed the title Pin setup-php to 2.37.1 in plugin-check workflow Fix Plugin Check job: clear GitHub token for wp-cli package install May 29, 2026
ilicfilip and others added 4 commits May 29, 2026 15:19
wp-cli writes GITHUB_TOKEN to Composer's github-oauth config whenever it is
a string (an empty env value still counts), and Composer rejects the Actions
token as "invalid characters". Unsetting the var in the shell makes getenv()
return false so wp-cli skips token config; the single public package fetch
runs unauthenticated, within rate limits.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…oken

The Plugin Check job fails at `wp package install` because the Composer
bundled in the stable WP-CLI phar rejects the new GitHub Actions token
format (hyphens) with "contains invalid characters" — composer#12076.
The token is exported by setup-php via COMPOSER_AUTH, so neutralizing
GITHUB_TOKEN had no effect. The nightly WP-CLI bundles a Composer with
relaxed token validation, fixing it at the root.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The nightly update failed with "/usr/local/bin/wp-cli is not writable by
current user" because setup-php installs the phar to a root-owned path.
Run the update via sudo so it can replace the phar in place.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ilicfilip ilicfilip changed the title Fix Plugin Check job: clear GitHub token for wp-cli package install Fix Plugin Check job: update WP-CLI so Composer accepts new GitHub token format May 29, 2026
The Plugin Check job regressed (last passed 2026-05-05) without any change
on our side. plugin-check-action installs @wordpress/env unpinned, so it
pulls the latest; 11.6.0/11.7.0 migrated nodegit -> simple-git, which breaks
the action's wp-env start (stalls at "Reading configuration", environment
never initializes). Pin the global install to 11.5.0, the last version our
job ran green with. Also bump the action to v1.1.6.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ilicfilip ilicfilip changed the title Fix Plugin Check job: update WP-CLI so Composer accepts new GitHub token format Fix Plugin Check CI: WP-CLI token fix done; wp-env regression blocked upstream May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant