Skip to content

Commit

Permalink
Update doc-comments
Browse files Browse the repository at this point in the history
  • Loading branch information
carstingaxion committed Jul 28, 2024
1 parent 8ef56b8 commit c303b63
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 27 deletions.
22 changes: 16 additions & 6 deletions .github/scripts/create-preview-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,30 @@
* https://github.com/Automattic/themes/blob/a0c9b91f827f46ed60c502d41ef881b2f0552f03/.github/scripts/create-preview-links.js
*/

/*
* This function creates the URL where to download the built & zipped plugin.
*
* @param {object} context - The context of the event that triggered the action.
* @param {number} number - The PR number where the plugin changes are located.
* @returns {string} - The URL where to download the built & zipped plugin, as an artifact of the workflow.
*/
function createBlueprintUrl(context, number) {
const { repo, owner } = context;
const workflow = encodeURI('Playground Preview');
const artifact = 'gatherpress-pr';
const proxy = 'https://hub.carsten-bach.de/gatherpress/plugin-proxy.php';
// const proxy = 'https://gatherpress.org/playground-preview/plugin-proxy.php';

return `${proxy}/?org=${owner}&repo=${repo}&workflow=${workflow}&artifact=${artifact}&pr=${number}`;
}

/*
* This function creates a WordPress Playground blueprint JSON string for a theme.
* This function creates a WordPress Playground blueprint JSON string for a given PR of the GatherPress plugin.
*
* @param {string} themeSlug - The slug of the theme to create a blueprint for.
* @param {string} branch - The branch where the theme changes are located.
* @returns {string} - A JSON string representing the blueprint.
* @param {object} context - The context of the event that triggered the action.
* @param {number} number - The PR number where the plugin changes are located.
* @param {string} zipArtifactUrl - The URL where to download the built & zipped plugin, as an artifact of the workflow.
* @returns {string} - A JSON string representing the steps of a blueprint.
*/
function createBlueprint(context, number, zipArtifactUrl) {
const { repo, owner } = context;
Expand Down Expand Up @@ -105,8 +114,9 @@ function createBlueprint(context, number, zipArtifactUrl) {
}

/*
* This function creates a comment on a PR with preview links for ...
* It is used by `preview-playground` workflow.
* This function creates a comment on a PR with preview links.
*
* It is used by `playground-preview` workflow.
*
* @param {object} github - An authenticated instance of the GitHub API.
* @param {object} context - The context of the event that triggered the action.
Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/playground-preview.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# name: Prepare a .zip file with the current state of the plugin
# For now (!) the name here is important and should not be changed!
#
# The plugin-proxy.php does a check against exact this workflow name.
Expand Down Expand Up @@ -77,26 +76,6 @@ jobs:
name: ${{ github.event.repository.name }}-pr
path: ./${{ github.event.repository.name }}.zip

# blueprint:
# name: Create blueprint.json
# needs: zip
# runs-on: ubuntu-latest
# steps:
# - uses: actions/github-script@v7
# with:
# # Based on: https://github.com/WordPress/wordpress-playground/blob/trunk/packages/playground/website/public/gutenberg.html
# script: |
# // Get link to the Playground site with the Blueprint to download and apply the PR
# // "landingPage" should better be set via query API param 'url'.
# const blueprint = {
# landingPage: '/wp-admin/edit.php?post_type=gatherpress_event',

# // console.log( blueprint );
# const encoded = JSON.stringify(blueprint);
# console.log( 'WordPress playground Builder: ','https://playground.wordpress.net/builder/builder.html#' + encodeURI(encoded) );
# console.log( 'Normal WordPress playground: ', 'https://playground.wordpress.net/#' + encodeURI(encoded) );
# console.log( 'Seamless WordPress playground: ', 'https://playground.wordpress.net/?mode=seamless#' + encodeURI(encoded) );

comment:
name: Comment with playground link
# https://github.com/actions/github-script?tab=readme-ov-file#comment-on-an-issue
Expand Down

0 comments on commit c303b63

Please sign in to comment.