TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ateeducacion/moodle-playground/llms.txt
Use this file to discover all available pages before exploring further.
ateeducacion/action-moodle-playground-pr-preview action posts an Open in Moodle Playground button on every pull request, so reviewers can boot the PR’s plugin (or Moodle core changes) in the browser with one click. No checkout, no local Moodle, no server required — the entire Moodle instance runs inside WebAssembly in the reviewer’s browser.
This page is a task-focused how-to. For the full input/output reference see the Action Reference.
Minimal setup
For a plugin that lives at the repository root, this is all you need:Add the workflow file
Create
.github/workflows/pr-preview.yml in your plugin repository with the following content:Push and open a PR
Commit and push the file. On the next opened or updated pull request, the action automatically appends a preview button to the PR description.
moodle-TYPE_NAME convention — for example, moodle-mod_board becomes type mod, name board. It then builds a blueprint that installs the plugin from the PR branch and appends the preview button to the PR description.
Scenarios
Each snippet below shows only thewith: block that changes. Keep the rest of the workflow (trigger, permissions, runs-on, uses:) identical to the minimal example above.
Plugin in a subdirectory
Pointplugin-path at the plugin directory when it is not at the repository root:
Inline blueprint
Provide a blueprint as a JSON string directly in the workflow. Whenblueprint is set, plugin-path is ignored:
Blueprint from a file in the repo
Useblueprint-file to read a JSON file from the checked-out repository. This requires actions/checkout as a preceding step:
For
blueprint-file, any installMoodlePlugin or installTheme GitHub archive URL that points at this repository is automatically rewritten to the PR branch, so reviewers test the PR code and not the base branch.Blueprint from a URL
Link to a remote blueprint file. The generated preview link uses a?blueprint-url= query parameter rather than inlining the blueprint content:
Large blueprints via a proxy
Long inline blueprints can exceed URL limits and fail with HTTP 414. Serve the blueprint through a CORS-enabled GitHub proxy endpoint instead of inlining it:proxy-url together with blueprint-file keeps the preview link short regardless of blueprint size.
Comment vs. description mode
By default the button is appended to the PR description (mode: append-to-description). To post it as a separate comment instead:
Moodle core PR overlay
To preview changes to Moodle core (not a plugin), setpreview-type: core. The action boots a prebuilt base for the target branch and overlays the PR’s changed files at runtime — no per-PR bundle is built:
MOODLE_404_STABLE maps to 4.4. Override the inferred version with the base-version input if needed.
Required permissions
The job must grant bothcontents: read and pull-requests: write so the action can read the repository and post or update the preview button:
github-token defaults to the workflow’s built-in GITHUB_TOKEN. Passing ${{ secrets.GITHUB_TOKEN }} explicitly is recommended for clarity and auditability.
Limitations
- Ephemeral runtime. The preview holds no data after the tab closes. It is intended for review, not persistent storage.
- Outbound network. Plugin, theme, and language pack downloads happen entirely in the browser. Firefox and Safari cannot make outbound calls from WASM PHP, so Chromium-based browsers are the most reliable for previews. A proxy may be needed for ZIP fetches.
- Branch must be pushed. The plugin install URL points at the PR’s remote branch. The branch must exist on the remote — it cannot be a purely local branch.
- Core overlay fidelity. Overlays are subject to the caps and exclusions described in the warning above.
- SQLite only. The playground uses an experimental PDO driver patch for SQLite — this is not full production parity with MySQL or PostgreSQL.
Common errors
| Symptom | Cause and fix |
|---|---|
Resource not accessible by integration | The job is missing pull-requests: write. Add it to the permissions block. |
| Plugin missing in the preview | The PR branch is not on the remote. The install URL requires the pushed branch — push it before opening the PR. |
| HTTP 414 (URL too long) | The inline blueprint is too large. Use blueprint-url, or blueprint-file with proxy-url to avoid embedding the blueprint in the URL. |
| Core overlay incomplete | Hitting the overlay caps (file count, size limit, or skipped binaries) or a missing database upgrade. Reduce the changeset size or test those parts locally. |
See also
Action Reference
Full inputs and outputs tables for
action-moodle-playground-pr-preview@v1.Blueprints Overview
What blueprints can do and the full list of supported steps.
Action Repository
README with advanced options and latest release notes.