Skip to content

Commit d07c88a

Browse files
committed
merged workflow too
1 parent 4948aae commit d07c88a

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

.github/workflows/playground-merged.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,35 @@ jobs:
1010
if: github.event.pull_request.merged == true
1111
runs-on: ubuntu-latest
1212
permissions:
13+
contents: read
1314
pull-requests: write
15+
actions: read
1416
steps:
17+
- name: Prepare blueprint with artifact link
18+
id: blueprint
19+
run: |
20+
set -euxo pipefail
21+
ARTIFACT_URL="${{ github.server_url }}/${{ github.repository }}/archive/refs/heads/develop.zip"
22+
23+
# Use Node.js to parse, modify, and stringify the JSON
24+
BLUEPRINT=$(node -e "
25+
const fs = require('fs');
26+
const blueprint = JSON.parse(fs.readFileSync('.wordpress-org/blueprints/playground.json', 'utf8'));
27+
blueprint.plugins = blueprint.plugins.map(plugin =>
28+
plugin === '${{ github.event.repository.name }}' ? '$ARTIFACT_URL' : plugin
29+
);
30+
console.log(JSON.stringify(blueprint));
31+
")
32+
33+
# Base64 encode the blueprint
34+
ENCODED_BLUEPRINT=$(echo -n "$BLUEPRINT" | base64 -w 0)
35+
36+
echo "blueprint=$ENCODED_BLUEPRINT" >> "$GITHUB_OUTPUT"
37+
38+
# Comment with a Playground link that installs from the artifact ZIP
1539
- uses: mshick/add-pr-comment@v2
1640
with:
1741
message: |
1842
**Test merged PR on Playground**
19-
[Test this pull request on the Playground](https://playground.wordpress.net/?blueprint-url=https%3A%2F%2Fprogressplanner.com%2Fresearch%2Fblueprint-pp.php%3Frepo%3D${{ github.repository }}) or [download the zip](${{ github.server_url }}/${{ github.repository }}/archive/refs/heads/develop.zip).
43+
[Test this pull request on the Playground](https://playground.wordpress.net/#${{ steps.blueprint.outputs.blueprint }})
44+
or [download the zip](${{ github.server_url }}/${{ github.repository }}/archive/refs/heads/develop.zip)

0 commit comments

Comments
 (0)