Skip to content

Commit 466b2ed

Browse files
chore: add WP Playground preview link
1 parent b2ec3f0 commit 466b2ed

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

.github/workflows/build-dev-artifacts.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,14 @@ jobs:
7777
- name: Get comment body
7878
id: get-comment-body
7979
run: |
80+
previewLink=$(node ./bin/generatePlaygroundPreviewLink.js)
81+
8082
body="Plugin build for ${{ github.event.pull_request.head.sha }} is ready :bellhop_bell:!
81-
- Download [build](https://verti-artifacts.s3.amazonaws.com/${{ github.event.pull_request.base.repo.name }}-${{ needs.dev-zip.outputs.branch-name }}-${{ needs.dev-zip.outputs.git-sha-8 }}/feedzy-rss-feeds.zip)"
83+
- Download [build](https://verti-artifacts.s3.amazonaws.com/${{ github.event.pull_request.base.repo.name }}-${{ needs.dev-zip.outputs.branch-name }}-${{ needs.dev-zip.outputs.git-sha-8 }}/feedzy-rss-feeds.zip)
84+
85+
> [!NOTE]
86+
> You can preview the changes in the <a href=\"$previewLink\" target=\"_blank\">Playground</a>
87+
"
8288
body="${body//$'\n'/'%0A'}"
8389
echo "::set-output name=body::$body"
8490
- name: Create comment on PR with links to plugin builds

bin/generatePlaygroundPreviewLink.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env node
2+
// Read GitHub Action environment variables.
3+
const repoName = process.env.GITHUB_REPO_NAME || '';
4+
const branchName = process.env.DEV_ZIP_BRANCH_NAME || '';
5+
const gitSha8 = process.env.DEV_ZIP_GIT_SHA_8 || '';
6+
7+
// Create the blueprint object with necessary schema and options.
8+
const blueprint = {
9+
preferredVersions: {
10+
php: '8.0',
11+
},
12+
plugins: [
13+
'wpide',
14+
`https://verti-artifacts.s3.amazonaws.com/${repoName}-${branchName}-${gitSha8}/feedzy-rss-feeds.zip`,
15+
],
16+
login: true,
17+
landingPage: '/wp-admin/post-new.php?post_type=feedzy_imports',
18+
features: {
19+
networking: true,
20+
},
21+
};
22+
23+
// Convert the blueprint object to JSON and then encode it in Base64.
24+
const blueprintJson = JSON.stringify(blueprint);
25+
const encodedBlueprint = Buffer.from(blueprintJson).toString('base64');
26+
27+
// Output the full preview link.
28+
process.stdout.write('https://playground.wordpress.net/#' + encodedBlueprint);

0 commit comments

Comments
 (0)