From 2b32d347d8bb9912b126e4c4d941bff67573537b Mon Sep 17 00:00:00 2001 From: ingeniumed Date: Fri, 21 Feb 2025 14:35:15 +1100 Subject: [PATCH] Attempting to make the script redundant --- .github/workflows/pr-build-live-branch.yml | 10 +++++----- .../workflows/scripts/generate-playground-blueprint.js | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr-build-live-branch.yml b/.github/workflows/pr-build-live-branch.yml index 5c4783b4..8156fab5 100644 --- a/.github/workflows/pr-build-live-branch.yml +++ b/.github/workflows/pr-build-live-branch.yml @@ -73,9 +73,9 @@ jobs: if-no-files-found: 'error' overwrite: true - - name: Comment on PR with WordPress Playground details - uses: actions/github-script@v7 + - name: Create comment with Playground preview + uses: peter-evans/create-or-update-comment@v4 with: - script: | - const { run } = require('./.github/workflows/scripts/generate-playground-blueprint'); - run({ github, context }); + issue-number: ${{ github.event.pull_request.number }} + body: | + Test this PR in [WordPress Playground](https://playground.wordpress.net/#{"landingPage":"/wp-admin/admin.php?page=remote-data-blocks-settings","features":{"networking":true},"login":true,"preferredVersions":{"php":"8.2","wp":"latest"},"steps":[{"step":"defineWpConfigCosts","consts":{"USE_PLAYGROUND_CORS_PROXY":true}},{"step":"installPlugin","pluginData":{"caption":"Installing Remote Data Blocks","resource":"url","url":"https://wordpress-playground.atomicsites.blog/plugin-proxy.php?org=Automattic&repo=remote-data-blocks&workflow=Build%20Live%20Branch&artifact=remote-data-blocks-${{ github.event.pull_request.number }}&pr=${{ github.event.pull_request.number }}"},"options":{"activate":true,"targetFolderName":"remote-data-blocks"}}]}). diff --git a/.github/workflows/scripts/generate-playground-blueprint.js b/.github/workflows/scripts/generate-playground-blueprint.js index 4800b05c..b914e525 100644 --- a/.github/workflows/scripts/generate-playground-blueprint.js +++ b/.github/workflows/scripts/generate-playground-blueprint.js @@ -74,9 +74,11 @@ async function run( { github, context } ) { } } - const defaultSchema = generateWordpressPlaygroundBlueprint( context.issue.number ); + const defaultSchema = generateWordpressPlaygroundBlueprint(context.issue.number); - const url = `https://wordpress-playground.atomicsites.blog/#${ JSON.stringify( defaultSchema ) }`; + const uriComponent = encodeURIComponent( JSON.stringify( defaultSchema ) ); + + const url = `https://wordpress-playground.atomicsites.blog/#${ uriComponent }`; const body = ` ## Test using WordPress Playground