Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ concurrency:

permissions:
contents: read
pull-requests: write

env:
COMPOSER_NO_INTERACTION: 1
Expand Down Expand Up @@ -172,3 +173,68 @@ 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: '<!-- wp-playground-link -->'

- 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": "<?php require_once '/wordpress/wp-load.php'; global $wp_rewrite; $wp_rewrite->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
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
<!-- wp-playground-link -->
## Test in WordPress Playground

Test the plugin **with the code from this branch**:

**[Open in WordPress Playground](${{ steps.playground-url.outputs.url }})**

> ⚠️ The embedded eXeLearning editor is not available in this preview (requires build). All other plugin features (ELP upload, shortcode, Gutenberg block, preview) work normally.