-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (39 loc) · 1.58 KB
/
playground-merged.yml
File metadata and controls
46 lines (39 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Playground Comment
on:
pull_request:
types:
- closed
jobs:
if_merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
actions: read
steps:
- uses: actions/checkout@v4
- name: Prepare blueprint with artifact link
id: blueprint
run: |
set -euxo pipefail
ARTIFACT_URL="${{ github.server_url }}/${{ github.repository }}/archive/refs/heads/develop.zip"
# Use Node.js to parse, modify, and stringify the JSON
BLUEPRINT=$(node -e "
const fs = require('fs');
const blueprint = JSON.parse(fs.readFileSync('.wordpress-org/blueprints/playground.json', 'utf8'));
blueprint.plugins = blueprint.plugins.map(plugin =>
plugin === '${{ github.event.repository.name }}' ? '$ARTIFACT_URL' : plugin
);
console.log(JSON.stringify(blueprint));
")
# Base64 encode the blueprint
ENCODED_BLUEPRINT=$(echo -n "$BLUEPRINT" | base64 -w 0)
echo "blueprint=$ENCODED_BLUEPRINT" >> "$GITHUB_OUTPUT"
# Comment with a Playground link that installs from the artifact ZIP
- uses: mshick/add-pr-comment@v2
with:
message: |
**Test merged PR on Playground**
[Test this pull request on the Playground](https://playground.wordpress.net/#${{ steps.blueprint.outputs.blueprint }})
or [download the zip](${{ github.server_url }}/${{ github.repository }}/archive/refs/heads/develop.zip)