Skip to content

Fix Plugin Check workflow to use @wordpress/env for wp-env lifecycle - #40

Closed
mustafauysal with Copilot wants to merge 2 commits into
developfrom
copilot/update-plugin-check-workflow
Closed

Fix Plugin Check workflow to use @wordpress/env for wp-env lifecycle#40
mustafauysal with Copilot wants to merge 2 commits into
developfrom
copilot/update-plugin-check-workflow

Conversation

Copilot AI commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

The PR’s Plugin Check job was still failing because workflow steps invoked npx wp-env, which makes npm resolve a non-existent wp-env package. This update switches those lifecycle commands to the correct CLI package so CI can start/stop the WordPress environment reliably.

  • Workflow command correction

    • Replaced incorrect wp-env invocations with @wordpress/env in .github/workflows/plugin-check.yml.
    • Updated both environment startup and cleanup commands for consistency.
  • Scope

    • Limited to the Plugin Check workflow file; no unrelated workflow/job behavior was changed.
- name: Start WordPress environment
  run: npx @wordpress/env start

- name: Stop WordPress environment
  if: always()
  run: npx @wordpress/env stop
Original prompt

The open pull request for repository HandyPlugins/security-txt-manager attempted to fix the failing Plugin Check GitHub Actions workflow, but the workflow is still failing.

Latest failing run:

Current failure from logs:

  • npm error 404 Not Found - GET https://registry.npmjs.org/wp-env - Not found
  • npm error 404 'wp-env@*' is not in this registry.

Current workflow state:

  • A step was added:
    • Start WordPress environment
    • run: npx wp-env start
  • A cleanup step was also added:
    • run: npx wp-env stop

Root cause:

  • The package name wp-env is incorrect on npm.
  • The correct CLI package is @wordpress/env, so npx wp-env start causes npm to try resolving a nonexistent wp-env package.

Please update the existing PR branch with the minimal safe fix so the workflow uses the correct package/command. Focus on the workflow file only.

Implementation guidance:

  • Update .github/workflows/plugin-check.yml.
  • Replace the incorrect environment startup command with a valid one using the correct package, e.g. npx @wordpress/env start or another equivalent invocation that works in CI.
  • Update the stop/cleanup step consistently, e.g. npx @wordpress/env stop.
  • Keep the rest of the workflow unchanged unless another very small adjustment is clearly needed for this fix.
  • Ensure YAML syntax remains valid.

Acceptance criteria:

  • The workflow no longer attempts to install/run the nonexistent wp-env npm package.
  • The workflow starts and stops the WordPress environment using the correct package.
  • The fix updates the existing PR rather than creating unrelated changes.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.

Assistant: The failure is caused by the job invoking a WordPress environment check without first starting the environment:

Fix

Initialize wp-env before the Run Plugin Check step.

Suggested workflow change

Update .github/workflows/plugin-check.yml to add a setup step before line 40:

name: Plugin Check

on:
  pull_request:
  push:
    branches:
      - main
      - develop

jobs:
  plugin-check:
    name: Plugin Check
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '7.4'
          coverage: none

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Install Composer dependencies
        run: composer install --no-dev --prefer-dist --no-progress --no-interaction

      - name: Install NPM dependencies
        run: npm ci --no-audit

      - name: Build assets
        run: npm run build

      - name: Start WordPress environment
        run: npx wp-env start

      - name: Run Plugin Check
        uses: WordPress/plugin-check-action@v1
        with:
          build-dir: '.'
          exclude-directories: 'node_modules,vendor,.git,.github,.wordpress-org,.husky,tests'
          exclude-files: '.browserslistrc,.distignore,.editorconfig,.eslintignore,.eslintrc.json,.gitignore,.lintstagedrc.json,.npmrc,.nvmrc,.stylelintignore,.stylelintrc,babel.config.js,composer.json,composer.lock,package-lock.json,package.json,phpcs.xml.dist,phpunit.xml.dist,webpack.config.js'

Why this fixes it

The action at .github/workflows/plugin-check.yml#L40-L45 runs in an environment that expects wp-env to already be running. Right now, the workflow installs dependencies and builds assets, but never starts WordPress.

Optional hardening

To avoid leftover containers and make failures easier to debug, you can wrap cleanup with if: always():

      - name: Start WordPress environment
        run: npx wp-env start

      - name: Run Plugin Check
        uses: WordPress/plugin-check-action@v1
        with:
          build-dir: '.'
       ...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

*This pull request was created from Copilot chat.*
>

Copilot AI changed the title [WIP] Fix npm error in Plugin Check workflow Fix Plugin Check workflow to use @wordpress/env for wp-env lifecycle Jun 4, 2026
Copilot AI requested a review from mustafauysal June 4, 2026 09:14
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.

2 participants