Skip to content

Playground preview: re-run on label changes, fetch labels via gh CLI - #732

Open
jdevalk wants to merge 11 commits into
developfrom
jdv/smarter-playground
Open

jdevalk wants to merge 11 commits into
developfrom
jdv/smarter-playground

Conversation

@jdevalk

@jdevalk jdevalk commented Dec 19, 2025 •

Copy link
Copy Markdown
Member

Improves the Playground preview workflow:

  • Re-run preview when labels are added/removed (not just on commits).
  • Work around github.event.pull_request.labels being empty on opened/synchronize/reopened events by fetching labels via the gh CLI.
  • Switch to WP Playground (from prior preview backend) with extra debug output.

@github-actions

github-actions Bot commented Dec 19, 2025 •

Copy link
Copy Markdown
Contributor

Test on Playground
Test this pull request on the Playground
or download the zip

@github-actions

github-actions Bot commented Dec 19, 2025 •

Copy link
Copy Markdown
Contributor

✅ Code Coverage Report

Metric Value
Total Coverage 37.44% 📉
Base Coverage 37.44%
Difference 📈 0.00%

⚠️ Coverage below recommended 40% threshold

🎉 Great job maintaining/improving code coverage!

ℹ️ About this report
  • All tests run in a single job with Xdebug coverage
  • Security tests excluded from coverage to prevent output issues
  • Coverage calculated from line coverage percentages

@jdevalk jdevalk changed the title Try it Playground preview: re-run on label changes, fetch labels via gh CLI May 24, 2026
@jdevalk
jdevalk requested review from aristath and ilicfilip May 29, 2026 06:41
The success-path console.log debug statements wrote to stdout, which
BLUEPRINT=$(node ...) captured along with the actual blueprint JSON.
The resulting base64 payload decoded to "PR Labels: []\nPlugin slugs:
[]\n{...}" — invalid JSON that playground.wordpress.net could not parse,
breaking the preview link. Switch the three debug logs to console.error
so only the blueprint JSON lands on stdout.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ilicfilip

Copy link
Copy Markdown
Collaborator

There was an error in the Playground link, JSON was malformed:

to fix other issues (now failed workflows), we should first merge #764 and then update this branch and see what is left

@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

🔍 WordPress Plugin Check Report

⚠️ Status: Passed with warnings

📊 Report

🎯 Total Issues ❌ Errors ⚠️ Warnings
10 0 10

⚠️ Warnings (10)

📁 classes/suggested-tasks/data-collector/class-unpublished-content.php (1 warning)
📍 Line 🔖 Check 💬 Message
103 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
📁 classes/suggested-tasks/providers/class-content-review.php (4 warnings)
📍 Line 🔖 Check 💬 Message
232 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
377 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
381 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
388 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
📁 classes/activities/class-query.php (2 warnings)
📍 Line 🔖 Check 💬 Message
71 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $table_name used in $wpdb->query()\n$table_name assigned unsafely at line 58.
163 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $where_args used in $wpdb->get_results()\n$where_args assigned unsafely at line 153.
📁 classes/suggested-tasks/data-collector/class-yoast-orphaned-content.php (1 warning)
📍 Line 🔖 Check 💬 Message
111 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $query used in $wpdb->get_row()\n$query assigned unsafely at line 98.
📁 classes/suggested-tasks/data-collector/class-terms-without-description.php (1 warning)
📍 Line 🔖 Check 💬 Message
108 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $query used in $wpdb->get_results()\n$query assigned unsafely at line 106.
📁 classes/suggested-tasks/data-collector/class-terms-without-posts.php (1 warning)
📍 Line 🔖 Check 💬 Message
120 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $query used in $wpdb->get_results()\n$query assigned unsafely at line 118.

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

The Node script was inlined through a heredoc starting at column 0,
which ends the YAML `run: |` block. GitHub could not parse
playground.yml, so no preview has run on this branch since December.

- Move the blueprint logic to .github/scripts/playground-blueprint.js;
  it only prints the blueprint on stdout, so logs never leak into the link.
- Use the same script in playground-merged.yml, so merged-PR previews
  also get the plugin:<slug> plugins now that wordpress-seo is no longer
  in playground.json by default.
- Only re-run on label changes for plugin:* labels, and keep one
  preview run per PR (concurrency, cancel in progress).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Signed-off-by: Filip Ilic <ilic.filip@gmail.com>
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Plugin readme preview

Open preview · Commit 83f9663

36 passed · 1 warning · 0 notes

Warnings

  • “Tested up to” is 7.2; the latest WordPress major release is 7.1. Test with 7.1 and update the header.
Passed checks (36)
  • 144 / 150 characters in the short description.
  • Plugin name header recognized.
  • License header recognized: GPL3+.
  • 4 tags accepted within the five-tag limit.
  • Description is within the parser’s word limit.
  • Installation is within the parser’s word limit.
  • Faq is within the parser’s word limit.
  • Changelog is within the parser’s word limit.
  • Stable tag is declared: 1.10.1.
  • The PHP Version header is declared: 1.10.1.
  • Stable tag matches the PHP Version header: 1.10.1.
  • The readme “Requires at least” value is valid: 6.7.
  • The PHP “Requires at least” header is a numeric version: 6.7.
  • “Requires at least” matches between the readme and PHP header: 6.7.
  • The readme “Requires PHP” value is valid: 7.4.
  • The PHP “Requires PHP” header is a numeric version: 7.4.
  • “Requires PHP” matches between the readme and PHP header: 7.4.
  • “Tested up to” 7.2 meets the minimum WordPress version 6.7.
  • Installation content is present.
  • FAQ content is present.
  • Changelog content is present.
  • Screenshot captions are present.
  • The first changelog release matches Stable tag: 1.10.1.
  • The first changelog release matches PHP Version: 1.10.1.
  • Banner image loaded.
  • Plugin icon loaded.
  • Screenshot 1 has a matching image and caption.
  • Screenshot 2 has a matching image and caption.
  • Screenshot 3 has a matching image and caption.
  • Screenshot 4 has a matching image and caption.
  • Screenshot 5 has a matching image and caption.
  • Screenshot 6 has a matching image and caption.
  • Screenshot 7 has a matching image and caption.
  • Screenshot 8 has a matching image and caption.
  • Screenshot 9 has a matching image and caption.
  • Plugin PHP header loaded.

Readme and PHP-header checks only; this does not test plugin runtime compatibility.

@ilicfilip

Copy link
Copy Markdown
Collaborator

I pushed a fix (83f9663) and merged develop into the branch (f22c6ca). It was 137 commits behind and there were no conflicts.

Why the preview wasn't showing: playground.yml wasn't valid YAML. The Node script was written to a file through a heredoc whose lines start at column 0 (const fs = require('fs');). A line that far left ends the indented run: | block, so GitHub couldn't parse the file. Every run since December failed with "workflow file issue", and the only preview comment here was from the old version of the workflow. Its link also had the debug output mixed into the JSON, which is the "malformed JSON" from my May comment.

What I changed:

  • New script: the blueprint logic now lives in .github/scripts/playground-blueprint.js. It prints only the blueprint on stdout and sends logs to stderr, so nothing else can end up in the link. Labels are passed in through an env var, so there are no temp files and no quoting problems.
  • Merged-PR previews: playground-merged.yml uses the same script, with the labels from the closed PR. This PR removes wordpress-seo from playground.json, so without this change merged-PR previews would have silently lost Yoast.
  • Fewer re-runs: label events only re-run the workflow for plugin:* labels; others like "needs review" don't change the preview. A concurrency group per PR cancels a run that's still going when a newer one starts.

What I tested:

  • The script locally, with no labels, plugin:wordpress-seo, a duplicate label, an empty plugin: label, invalid JSON and an empty variable.
  • On this PR, the full cycle: preview with the label → removed the label → the comment was rebuilt without Yoast → added the label back → Yoast was back in the link. The same comment was updated each time; no duplicate comments.
  • Both links opened in a clean browser. Progress Planner loads from the PR zip, and Yoast only appears when the label is set.
  • All 25 checks pass.

Before merging, the team should know: previews no longer include Yoast by default. To get Yoast in a preview, a PR needs the plugin:wordpress-seo label. Any wordpress.org plugin can be added the same way with plugin:<slug>. playground.json still sets the Yoast options and WPSEO_PREMIUM_* constants. They do no harm without Yoast, but they could be removed later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants