Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 4, 2026

The action creates .wp-env.json in the repository root during setup, but when build-dir defaults to ./, Plugin Check's hidden_files check flags it as an error—a false positive since this file only exists during CI and isn't distributed with the plugin.

Changes

  • Modified the "Set PLUGIN_DIR" step in action.yml to check if .wp-env.json already exists in the plugin directory and store the result in the WP_ENV_JSON_EXISTS environment variable
  • Modified the "Run Plugin Check" step in action.yml to conditionally append .wp-env.json to the --exclude-files parameter only if it was created by the action
  • Handles both cases: when users provide their own exclude-files list (appends to it) and when they don't (creates new list)
# Only exclude .wp-env.json if it was created by this action (didn't exist before)
if [ "$WP_ENV_JSON_EXISTS" = "false" ]; then
  if [ -n "$EXCLUDE_FILES" ]; then
    EXCLUDE_FILES="--exclude-files=${EXCLUDE_FILES#--exclude-files=},.wp-env.json"
  else
    EXCLUDE_FILES="--exclude-files=.wp-env.json"
  fi
fi

This ensures that:

  • If a plugin legitimately has a .wp-env.json file as part of its codebase, it will be checked by Plugin Check
  • If .wp-env.json doesn't exist and is created by the action, it will be excluded from checks to avoid false positives
Original prompt

This section details on the original issue you should resolve

<issue_title>The hidden_files check errors on .wp-env.json which is created by the action</issue_title>
<issue_description>Here's the red error that I'm getting:

hidden_files: .wp-env.json#L0
Hidden files are not permitted.

I might be able to suppress the error myself, but it seems like this means that everyone running the default configuration is getting this error? Thank you for checking! ❤️ </issue_description>

Comments on the Issue (you are @copilot in this section)

@swissspidy How are you using the GitHub Action in your repo? I assume you don't use the `build-dir` option?

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Fix hidden files check error for .wp-env.json Exclude .wp-env.json from Plugin Check to prevent false positive hidden_files error Jan 4, 2026
Copilot AI requested a review from swissspidy January 4, 2026 19:56
@swissspidy
Copy link
Member

@copilot There could already be a .wp-env.json file in the plugin under test, in which case it shouldn't be excluded. So perhaps first check if it exists (before the "Setup wp-env" step)

Copy link
Contributor Author

Copilot AI commented Jan 5, 2026

@copilot There could already be a .wp-env.json file in the plugin under test, in which case it shouldn't be excluded. So perhaps first check if it exists (before the "Setup wp-env" step)

Good catch! I've updated the logic to check if .wp-env.json exists in the plugin directory before the action creates one. Now it only excludes the file if it was created by the action (commit a0ed182). If a plugin already has .wp-env.json, it will be properly checked by Plugin Check.

Copilot AI changed the title Exclude .wp-env.json from Plugin Check to prevent false positive hidden_files error Conditionally exclude .wp-env.json from Plugin Check to prevent false positive hidden_files error Jan 5, 2026
@github-actions
Copy link

github-actions bot commented Jan 5, 2026

🔍 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 January 5, 2026 18:08
@swissspidy swissspidy merged commit 27b60e8 into main Jan 5, 2026
2 checks passed
@swissspidy swissspidy deleted the copilot/fix-hidden-files-check-error branch January 5, 2026 21:45
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.

The hidden_files check errors on .wp-env.json which is created by the action

2 participants