From 0fc9945a73d1930bb1666174a3d1bfcf448ddd91 Mon Sep 17 00:00:00 2001 From: Ernesto Serrano Date: Mon, 9 Mar 2026 23:10:02 +0000 Subject: [PATCH 1/3] Add PR preview feature --- .github/workflows/ci.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bbe4c28..6680e66 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,6 +24,7 @@ concurrency: permissions: contents: read + pull-requests: write env: COMPOSER_NO_INTERACTION: 1 @@ -172,3 +173,33 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} files: artifacts/coverage/clover.xml fail_ci_if_error: false + + playground: + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + timeout-minutes: 2 + permissions: + pull-requests: write + steps: + - name: Find existing Playground comment + uses: peter-evans/find-comment@v3 + id: find-comment + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: 'github-actions[bot]' + body-includes: '' + + - name: Add Playground link comment + if: steps.find-comment.outputs.comment-id == '' + uses: peter-evans/create-or-update-comment@v4 + with: + issue-number: ${{ github.event.pull_request.number }} + body: | + + ## Test in WordPress Playground + + Test the **latest released version** of the plugin: + + **[Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/${{ github.repository }}/refs/heads/main/blueprint.json)** + + > This link uses the latest published release, not the code from this PR branch. From 8e01c0ec45fb8eb3bb9eafd3043f81ecf7d21032 Mon Sep 17 00:00:00 2001 From: Ernesto Serrano Date: Mon, 9 Mar 2026 23:20:28 +0000 Subject: [PATCH 2/3] Add PR preview feature --- .github/workflows/ci.yml | 41 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6680e66..d35f006 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -189,6 +189,41 @@ jobs: comment-author: 'github-actions[bot]' body-includes: '' + - name: Build Playground URL + if: steps.find-comment.outputs.comment-id == '' + id: playground-url + run: | + PLUGIN_URL="https://github.com/${{ github.repository }}/archive/refs/heads/${{ github.head_ref }}.zip" + + BLUEPRINT=$(cat <<'BLUEPRINT_EOF' + { + "$schema": "https://playground.wordpress.net/blueprint-schema.json", + "preferredVersions": { "php": "latest", "wp": "latest" }, + "siteOptions": { "blogname": "eXeLearning PR Test" }, + "steps": [ + { "step": "setSiteLanguage", "language": "es_ES" }, + { + "step": "installPlugin", + "pluginData": { "resource": "url", "url": "PLUGIN_URL_PLACEHOLDER" }, + "options": { "activate": true } + }, + { + "step": "runPHP", + "code": "set_permalink_structure('/%postname%/'); $wp_rewrite->flush_rules(true); ?>" + } + ], + "features": { "networking": true }, + "login": true, + "landingPage": "/wp-admin/upload.php" + } + BLUEPRINT_EOF + ) + + BLUEPRINT=$(echo "$BLUEPRINT" | sed "s|PLUGIN_URL_PLACEHOLDER|${PLUGIN_URL}|g") + ENCODED=$(echo "$BLUEPRINT" | base64 -w 0) + PLAYGROUND_URL="https://playground.wordpress.net/#${ENCODED}" + echo "url=${PLAYGROUND_URL}" >> $GITHUB_OUTPUT + - name: Add Playground link comment if: steps.find-comment.outputs.comment-id == '' uses: peter-evans/create-or-update-comment@v4 @@ -198,8 +233,8 @@ jobs: ## Test in WordPress Playground - Test the **latest released version** of the plugin: + Prueba el plugin **con el codigo de esta rama**: - **[Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/${{ github.repository }}/refs/heads/main/blueprint.json)** + **[Abrir en WordPress Playground](${{ steps.playground-url.outputs.url }})** - > This link uses the latest published release, not the code from this PR branch. + > El editor embebido de eXeLearning no esta disponible en esta preview (requiere build). El resto de funcionalidad del plugin (subida de ELP, shortcode, bloque Gutenberg, previsualizacion) si funciona. From 3b8716a07a00b689bf138f9d12b7922cbe11c212 Mon Sep 17 00:00:00 2001 From: Ernesto Serrano Date: Mon, 9 Mar 2026 23:27:40 +0000 Subject: [PATCH 3/3] Add PR preview feature --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d35f006..19cf994 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -233,8 +233,8 @@ jobs: ## Test in WordPress Playground - Prueba el plugin **con el codigo de esta rama**: + Test the plugin **with the code from this branch**: - **[Abrir en WordPress Playground](${{ steps.playground-url.outputs.url }})** + **[Open in WordPress Playground](${{ steps.playground-url.outputs.url }})** - > El editor embebido de eXeLearning no esta disponible en esta preview (requiere build). El resto de funcionalidad del plugin (subida de ELP, shortcode, bloque Gutenberg, previsualizacion) si funciona. + > ⚠️ The embedded eXeLearning editor is not available in this preview (requires build). All other plugin features (ELP upload, shortcode, Gutenberg block, preview) work normally.