Skip to content

Stabilize Plugin Check by waiting for wp-env CLI readiness#41

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

Stabilize Plugin Check by waiting for wp-env CLI readiness#41
Copilot wants to merge 2 commits into
developfrom
copilot/update-plugin-check-workflow-again

Conversation

Copilot AI commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Plugin Check was still failing intermittently because the workflow invoked WordPress/plugin-check-action@v1 before the @wordpress/env cli service was actually up (service "cli" is not running). This update keeps the workflow shape intact and adds an explicit readiness gate between environment startup and plugin-check execution.

  • Workflow readiness gating

    • Added a Start WordPress environment step that starts @wordpress/env and immediately verifies container usability with a CLI command:
    • This ensures plugin-check runs only after the WordPress stack is responsive.
  • Deterministic cleanup

    • Added a Stop WordPress environment step with if: always() so cleanup runs even when plugin-check fails.
- name: Start WordPress environment
  run: |
    npx @wordpress/env start
    npx @wordpress/env run cli wp core is-installed --allow-root

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

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

Update the existing pull request for repository HandyPlugins/security-txt-manager to fix the still-failing Plugin Check workflow.

Latest failing job URL provided by the user:

Observed failure from logs:

  • Plugin Check debugging output shows:
    • ℹ Starting 'wp cli info' on the cli container.
    • service "cli" is not running
    • ✖ Command failed with exit code 1
  • Workflow file at the failing commit:
    • .github/workflows/plugin-check.yml
  • Current workflow already uses:
    • npx @wordpress/env start
    • npx @wordpress/env stop

Likely issue:

  • The workflow starts the WordPress environment but does not wait for the cli container / WordPress stack to become ready before WordPress/plugin-check-action@v1 runs.

Please update the existing PR branch with a minimal safe fix focused on the workflow file only.

Implementation guidance:

  • Update .github/workflows/plugin-check.yml.
  • After starting @wordpress/env, add an explicit readiness check that waits for the CLI container / WordPress environment to be usable before running plugin check.
  • A good candidate is to run something like npx @wordpress/env run cli wp core is-installed --allow-root after npx @wordpress/env start.
  • If needed, add a lightweight Docker diagnostic or verification step only if it helps make the workflow robust, but keep the change minimal.
  • Keep the rest of the workflow unchanged unless another very small adjustment is clearly required for this fix.
  • Ensure YAML syntax remains valid.

Acceptance criteria:

  • The workflow starts the WordPress environment using @wordpress/env.
  • The workflow waits for or verifies readiness of the environment before invoking WordPress/plugin-check-action@v1.
  • The change is limited to the workflow fix and updates the existing PR.

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:...

</details>



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

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

@mustafauysal mustafauysal marked this pull request as ready for review June 4, 2026 09:24
Copilot AI changed the title [WIP] Fix Plugin Check workflow to ensure cli container readiness Stabilize Plugin Check by waiting for wp-env CLI readiness Jun 4, 2026
Copilot AI requested a review from mustafauysal June 4, 2026 09:26
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