Skip to content

Commit

Permalink
Fix the link breakage, and match it to the playground proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
ingeniumed committed Feb 10, 2025
1 parent c553672 commit 924279b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/pr-build-live-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,13 @@ jobs:
with:
name: remote-data-blocks-${{ github.event.pull_request.number }}
path: unzips/remote-data-blocks
retention-days: 2
retention-days: 7
if-no-files-found: 'error'
overwrite: true

- name: Output artifact ID
run: echo 'Artifact ID is ${{ steps.create-playground-artifact-step.outputs.artifact-url }}'

- name: Comment on PR with WordPress Playground details
uses: actions/github-script@v7
with:
script: |
const { run } = require('./.github/workflows/scripts/generate-playground-blueprint');
const artifactUrl = '${{ steps.create-playground-artifact-step.outputs.artifact-url }}';
run({ github, context, core, artifactUrl });
run({ github, context });
10 changes: 5 additions & 5 deletions .github/workflows/scripts/generate-playground-blueprint.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const https = require( 'https' );

const generateWordpressPlaygroundBlueprint = ( prNumber, artifactUrl ) => {
const generateWordpressPlaygroundBlueprint = ( prNumber ) => {
const defaultSchema = {
meta: {
title: `Remote Data Blocks - PR #${ prNumber }`,
Expand Down Expand Up @@ -41,7 +41,7 @@ const generateWordpressPlaygroundBlueprint = ( prNumber, artifactUrl ) => {
pluginData: {
caption: 'Installing Remote Data Blocks',
resource: 'url',
url: `${ artifactUrl }`,
url: `https://playground.wordpress.net/plugin-proxy.php?org=Automattic&repo=remote-data-blocks&workflow=Build%20Live%20Branch&artifact=remote-data-blocks-${ prNumber }&pr=${ prNumber }`,
},
options: {
activate: true,
Expand All @@ -54,7 +54,7 @@ const generateWordpressPlaygroundBlueprint = ( prNumber, artifactUrl ) => {
return defaultSchema;
};

async function run( { github, context, core, artifactUrl } ) {
async function run( { github, context } ) {
const commentInfo = {
owner: context.repo.owner,
repo: context.repo.repo,
Expand All @@ -74,9 +74,9 @@ async function run( { github, context, core, artifactUrl } ) {
}
}

const defaultSchema = generateWordpressPlaygroundBlueprint( context.issue.number, artifactUrl );
const defaultSchema = generateWordpressPlaygroundBlueprint( context.issue.number );

const url = `https://playground.wordpress.net/#${ JSON.stringify( defaultSchema ) }`;
const url = `https://playground.wordpress.net/#${ encodeURIComponent(JSON.stringify(defaultSchema)) }`;

const body = `
## Test using WordPress Playground
Expand Down

0 comments on commit 924279b

Please sign in to comment.