Skip to content

Avoid wp-env silent startup failures when loading Plugin Check#590

Merged
swissspidy merged 2 commits into
mainfrom
copilot/fix-env-initialization-error
Jun 15, 2026
Merged

Avoid wp-env silent startup failures when loading Plugin Check#590
swissspidy merged 2 commits into
mainfrom
copilot/fix-env-initialization-error

Conversation

Copilot AI commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

plugin-check-action was generating a .wp-env.json that always loaded plugin-check from a download URL. On newer GitHub runner images, that URL-plugin path can cause wp-env to exit successfully without actually initializing the environment, leading to Environment not initialized. Run \wp-env start` first.` in later steps.

  • Remove the fragile URL-plugin bootstrap path

    • Stop adding https://downloads.wordpress.org/plugin/plugin-check.zip to the generated .wp-env.json.
    • Keep the generated config focused on core version, ports, and the checked plugin mapping.
  • Install Plugin Check after wp-env is up

    • Install and activate plugin-check via WP-CLI after wp-env start.
    • Reuse an existing install when present, activating it instead of reinstalling.
  • Fail early if wp-env did not actually start

    • Extend the retry-wrapped startup command to run wp-env run cli wp cli info immediately after wp-env start --update.
    • This turns silent startup failures into explicit failures that the retry step can catch.
  • Add focused regression coverage

    • Add a test that asserts the action no longer references plugin-check.zip.
    • Add a test that asserts startup now includes a post-boot verification command.
command: |
  wp-env start --update
  wp-env run cli wp cli info

Copilot AI changed the title [WIP] Fix environment not initialized error in action Avoid wp-env silent startup failures when loading Plugin Check Jun 15, 2026
Copilot AI requested a review from swissspidy June 15, 2026 12:49
@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown

🔍 WordPress Plugin Check Report

❌ Status: Failed

📊 Report

🎯 Total Issues ❌ Errors ⚠️ Warnings
9 8 1

❌ Errors (8)

📁 hello.php (7 errors)
📍 Line 🔖 Check 💬 Message
0 plugin_header_no_license Missing "License" in Plugin Header. Please update your Plugin Header with a valid GPLv2 (or later) compatible license.
0 missing_direct_file_access_protection PHP file should prevent direct access. Add a check like: if ( ! defined( 'ABSPATH' ) ) exit;
49 WordPress.WP.AlternativeFunctions.rand_mt_rand mt_rand() is discouraged. Use the far less predictable wp_rand() instead.
62 WordPress.Security.EscapeOutput.OutputNotEscaped All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
62 WordPress.WP.I18n.TextDomainMismatch Mismatched text domain. Expected 'hello-dolly-copy' but got 'hello-dolly'.
63 WordPress.Security.EscapeOutput.OutputNotEscaped All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$lang'.
64 WordPress.Security.EscapeOutput.OutputNotEscaped All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$chosen'.
📁 readme.txt (1 error)
📍 Line 🔖 Check 💬 Message
0 no_plugin_readme The plugin readme.txt does not exist.

⚠️ Warnings (1)

📁 hello.php (1 warning)
📍 Line 🔖 Check 💬 Message
72 WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound Functions declared in the global namespace by a theme/plugin should start with the theme/plugin prefix. Found: "dolly_css".

🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

@swissspidy
swissspidy marked this pull request as ready for review June 15, 2026 14:45
Copilot AI review requested due to automatic review settings June 15, 2026 14:45
@swissspidy
swissspidy merged commit 271ad63 into main Jun 15, 2026
3 checks passed
@swissspidy
swissspidy deleted the copilot/fix-env-initialization-error branch June 15, 2026 14:46
@swissspidy swissspidy linked an issue Jun 15, 2026 that may be closed by this pull request

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the composite action to avoid wp-env “silent success” startup failures caused by preloading Plugin Check via a remote ZIP URL, and instead installs/activates Plugin Check after the environment is confirmed running.

Changes:

  • Removes https://downloads.wordpress.org/plugin/plugin-check.zip from the generated .wp-env.json.
  • Extends the retry-wrapped wp-env startup to immediately verify the environment with wp-env run cli wp cli info.
  • Installs (or reuses and activates) the plugin-check plugin via WP-CLI after wp-env is up, and adds regression tests validating these behaviors.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
action.yml Stops preloading Plugin Check from a URL, adds a post-start verification command, and installs/activates Plugin Check via WP-CLI after boot.
src/action.test.ts Adds regression tests ensuring action.yml no longer references plugin-check.zip and includes the new startup verification command.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Error: Environment not initialized. Run wp-env start first.

3 participants