Skip to content

Commit ba28427

Browse files
committed
Try to parse and stringify
1 parent 61c2f9f commit ba28427

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

.github/workflows/playground.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,15 @@ jobs:
5858
set -euxo pipefail
5959
ARTIFACT_URL="https://nightly.link/${{ github.repository }}/actions/runs/${{ github.run_id }}/${{ github.event.repository.name }}.zip"
6060
61-
# Load blueprint and replace plugin name with artifact URL using | as delimiter
62-
BLUEPRINT=$(cat .wordpress-org/blueprints/blueprint.json | sed "s|\"progress-planner\"|\"${ARTIFACT_URL}\"|g")
61+
# Use Node.js to parse, modify, and stringify the JSON
62+
BLUEPRINT=$(node -e "
63+
const fs = require('fs');
64+
const blueprint = JSON.parse(fs.readFileSync('.wordpress-org/blueprints/blueprint.json', 'utf8'));
65+
blueprint.plugins = blueprint.plugins.map(plugin =>
66+
plugin === 'progress-planner' ? '$ARTIFACT_URL' : plugin
67+
);
68+
console.log(JSON.stringify(blueprint));
69+
")
6370
6471
# Base64 encode the blueprint
6572
ENCODED_BLUEPRINT=$(echo -n "$BLUEPRINT" | base64 -w 0)
@@ -81,5 +88,5 @@ jobs:
8188
with:
8289
message: |
8390
**Test on Playground**
84-
[Test this pull request on the Playground](https://playground.wordpress.net/?blueprint=${{ steps.blueprint.outputs.blueprint }})
91+
[Test this pull request on the Playground](https://playground.wordpress.net/#${{ steps.blueprint.outputs.blueprint }})
8592
or [download the zip](https://nightly.link/${{ github.repository }}/actions/runs/${{ github.run_id }}/${{ github.event.repository.name }}.zip)

0 commit comments

Comments
 (0)