Pin @wordpress/env in CI instead of resolving latest on every run

Open
#43 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
72/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
github-actions, node.js, php, wordpress
Domain
ci-cd, devops

Research direction

Start by reading .github/workflows/ci.yml and .github/dependabot.yml, then check .gitignore, .gitattributes, and contributor docs for existing package and wp-env guidance. Add an exact @wordpress/env dev dependency and lockfile, install with npm ci in the phpunit job, and use the local wp-env binary. Done when the CI steps, Dependabot configuration, archive decision, and any affected docs are updated.

Written by the indexing model from the issue text.

Description

Problem

The phpunit job in .github/workflows/ci.yml runs npx @wordpress/env start ... and npx @wordpress/env run .... The repo has no package.json or lockfile, so npx installs whatever version of @wordpress/env (and its whole dependency tree) is latest at the time of each run.

That means:

  • CI is not reproducible: a new wp-env release can break the PHPUnit jobs on an unrelated PR.
  • Unreviewed code from the npm registry runs in CI on every run.
  • Contributors may be running a different wp-env version locally than CI uses.

Proposal

Add a package.json and package-lock.json with @wordpress/env as an exact-version dev dependency, and install it with npm ci.

  • Add package.json ("private": true, @wordpress/env pinned exactly in devDependencies) and commit the generated package-lock.json
  • Add node_modules/ to .gitignore if not already present
  • In the phpunit job, add an npm ci step after "Set up Node"
  • Change both wp-env steps from npx @wordpress/env ... to npx wp-env ... so they use the locally installed binary
  • Add an npm entry to .github/dependabot.yml so the pin gets updated
  • Decide whether package.json / package-lock.json should be excluded from the Composer distribution archive (e.g. export-ignore in .gitattributes)
  • Update contributor docs if they reference npx @wordpress/env

Alternative considered

Pin the version inline (npx @wordpress/[email protected] ...). Smaller change, but it only pins the top-level package, leaves transitive dependencies floating, and Dependabot can't update a version inside a run: string.

Context

Follow-up to #42. Deliberately left out of that PR to keep it focused.

Dominant language
PHP
Stars
4
Forks
4
Avg merge
1d 23h
Merged PRs (30d)
18

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from WordPress/abilities

All issues in WordPress/abilities

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.