Skip to content

Build Playground links with wordpress-playground-action - #1843

Merged
pattonwebz merged 11 commits into
developfrom
playground-link-action
Jul 24, 2026
Merged

Build Playground links with wordpress-playground-action#1843
pattonwebz merged 11 commits into
developfrom
playground-link-action

Conversation

@pattonwebz

@pattonwebz pattonwebz commented Jul 24, 2026

Copy link
Copy Markdown
Member

Replaces the hand-rolled Playground link building in build-plugin-with-ref.yml with pattonwebz/wordpress-playground-action@v0.

Removed: the "Resolve public plugin URLs for Playground" step (manual nightly.link URL construction) and the "Build WordPress Playground links" step (an inline python3 -c one-liner that base64-encoded the blueprint). Both are now the action's job.

Net: -64/+32, one file.

Behaviour changes

No Playground link on release events. The action resolves artifacts through nightly.link, which only proxies Actions artifacts, not release assets. The old code special-cased release to emit a releases/download/... URL instead — but that URL had no consumer. The PR comment step is pull_request-only, so on a release the link only ever reached an echo in the Summary log. Releases already ship the real zip as a release asset, which is the better artifact anyway.

No Playground link for the ref (woocommerce) build. Also already unreachable: need_ref_build is only true for a workflow_dispatch carrying a ref value, or for a release — never for a pull_request. So a ref link could only ever have surfaced in a manual-dispatch job log.

The ref/woo build itself is untouched. It still builds and still attaches to releases. Verified the whole chain is intact: ref_param=woocommercecheck_refupdate-ref-param.sh → ref dist build → ref artifact upload → softprops/action-gh-release picking up REF_ZIP_PATH.

Net effect for reviewers: the PR comment on a gha-build label looks the same as before.

Other changes

  • Added actions: read to permissions: — the action uses it to verify the artifact exists before minting a link, so a wrong artifact name fails at build time instead of at click time.
  • plugin-slug: accessibility-checker is pinned rather than left to inference, keeping the activation path correct regardless of artifact naming.
  • Playground URLs reach the comment/Summary steps via env: rather than ${{ }} interpolated into the script body.
  • Dropped the github.event.repository.private == false guards — repo is public, and the action refuses private repos itself.

Verification

  • actionlint 1.7.7 on the final state: 2 errors, both pre-existing. Linted the pre-change file from develop as a baseline and got the identical pair (labels.*.name array-in-template at line 38, github.head_ref in an inline script at line 69). Neither is on a touched line, so both are left alone.
  • Dry-ran the action's build_blueprint.py against a real artifact name (accessibility-checker-1.47.0-1804-3959d1e4): the resulting zip-url matches the shape the old inline code produced, and plugin-path resolves to accessibility-checker/accessibility-checker.php.

One JSON difference worth knowing: the new blueprint uses installPlugin with options.activate: true instead of a separate activatePlugin step, and adds preferredVersions: {php: latest, wp: latest}. Same end state, different blueprint shape.

🤖 Generated with Claude Code

https://claude.ai/code/session_019LoLgW7oFjBPxGea9kiZJ2

Summary by CodeRabbit

  • Improvements
    • Updated pull request comments and build summaries to reflect Playground availability for primary plugin builds, showing “Not available for this run” when no primary link is generated.
    • Adjusted reporting logic for release builds and when primary generation is skipped, with clearer messaging.
    • Simplified ref-build reporting to focus on artifact presence rather than URL/blueprint details.
  • Bug Fixes
    • Improved consistency of generated Playground links for primary artifacts, including correct handling for release and skipped-primary scenarios.

pattonwebz and others added 2 commits July 24, 2026 20:38
Swaps the hand-rolled nightly.link URL construction and the inline
`python3 -c` blueprint one-liner for pattonwebz/wordpress-playground-action@v0.

Playground links are no longer built on `release`: the action resolves
artifacts via nightly.link, which only proxies Actions artifacts, not
release assets. Releases already ship the real zip as a release asset,
so the release-asset URL branch had no consumer - it only ever reached
an echo in the job log, never a PR comment.

plugin-slug is pinned rather than inferred, so the activation path stays
correct regardless of artifact naming.

Adds `actions: read`, which the action needs to verify the artifact
exists before building a link. Drops the now-dead
`github.event.repository.private == false` guards - the repo is public
and the action refuses private repos itself.

Verified with actionlint 1.7.7: the two remaining errors (lines 38, 69)
are pre-existing and identical to the pre-change baseline.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019LoLgW7oFjBPxGea9kiZJ2
The ref build itself is untouched - it still builds and still ships as a
release asset. Only its Playground link is removed.

That link was already unreachable: `need_ref_build` is only ever true for
a workflow_dispatch carrying a ref value, or for a release. It is never
true for a pull_request, and the PR comment step is the only place a
Playground link is surfaced to a human. So a ref link could only ever
have appeared in a manual-dispatch job log.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019LoLgW7oFjBPxGea9kiZJ2
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The workflow uses a dedicated WordPress Playground action for primary builds, passes its URL to pull request comments and summaries, and removes ref Playground URL reporting.

Changes

Primary Playground workflow

Layer / File(s) Summary
Generate the primary Playground URL
.github/workflows/build-plugin-with-ref.yml
Adds actions: read permission, adjusts Composer installation flags, and uses pattonwebz/wordpress-playground-action to generate a primary artifact Playground URL on eligible runs.
Report Playground availability
.github/workflows/build-plugin-with-ref.yml
Passes the generated URL to pull request comments and summaries, displays explicit unavailable-state messages, and reports ref builds using only their ZIP path.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Workflow
  participant PlaygroundAction
  participant PullRequestComment
  participant BuildSummary
  Workflow->>PlaygroundAction: Generate primary Playground URL
  PlaygroundAction-->>Workflow: Return PRIMARY_PLAYGROUND_URL
  Workflow->>PullRequestComment: Pass primary URL
  Workflow->>BuildSummary: Pass primary URL and run state
Loading

Possibly related PRs

Suggested labels: gha-build

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: replacing manual Playground link generation with wordpress-playground-action.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch playground-link-action

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/build-plugin-with-ref.yml:
- Around line 352-361: Update the “Playground (primary)” fallback in the build
summary to distinguish why the primary build was skipped: report release-asset
behavior only when the mode is release, and use a run-neutral message when
skip_primary is caused by a manual ref_param dispatch. Use the existing
steps.setref.outputs.mode value and preserve the successful URL output path.
- Around line 258-279: Update the uses reference in the playground_primary step
from the mutable pattonwebz/wordpress-playground-action@v0 tag to a specific
immutable commit SHA, preserving the existing inputs and execution condition.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a72e356b-a2a4-4942-89c7-ea543232e3f7

📥 Commits

Reviewing files that changed from the base of the PR and between 3959d1e and 762c5b6.

📒 Files selected for processing (1)
  • .github/workflows/build-plugin-with-ref.yml

Comment thread .github/workflows/build-plugin-with-ref.yml Outdated
Comment thread .github/workflows/build-plugin-with-ref.yml Outdated
The summary attributed every missing primary link to a release, but
`skip_primary` is also true for a workflow_dispatch carrying a ref
param - no release involved - so that run logged something false.

Branches on mode/skip_primary instead, with a run-neutral fallback for
anything unforeseen. Verified by executing the branch across all five
input combinations.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019LoLgW7oFjBPxGea9kiZJ2
`--prefer-offline` is an npm flag; composer install has no such option and
exits 1 on it, so the build failed before installing anything. It was
copy-pasted from the `npm ci --prefer-offline` line three lines below,
in 9bed611.

Composer uses its cache automatically and --prefer-dist is already
present, so there is nothing to replace the flag with.

This breaks every gha-build run on develop, not just this branch.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019LoLgW7oFjBPxGea9kiZJ2
@github-actions

Copy link
Copy Markdown
Contributor

✅ Accessibility Checker build (primary only)

pattonwebz and others added 3 commits July 24, 2026 22:29
Most of it explained steps that no longer exist, or restated what the
step's own `if`/`with` already says. Keeps only the two things reading
the step won't tell you.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019LoLgW7oFjBPxGea9kiZJ2
Explained a general Actions practice at a spot where the value is a URL
from our own action, and the pattern is already visible from the env
block two lines below.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019LoLgW7oFjBPxGea9kiZJ2
Deletes the local github-script comment step in favour of the action's
own sticky comment, using comment-template so the body is unchanged.

The action can now render the artifact download link itself - it exposes
the artifact ID it already fetches while verifying the artifact exists -
so the local step's separate listWorkflowRunArtifacts call is redundant.

Behaviour change: the comment is now sticky, updating one comment in
place instead of posting a new one per build.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019LoLgW7oFjBPxGea9kiZJ2
@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

✅ Accessibility Checker build

Built from 1770a0ee · 2026-07-24 22:27 UTC

Only one zip is ever linked from a PR build, so the qualifier
distinguishes it from nothing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019LoLgW7oFjBPxGea9kiZJ2
The comment is sticky now, so GitHub's own "commented N minutes ago" no
longer tells you whether what you are looking at is current.

Uses head.sha, not the existing short_sha output: for a pull_request event
actions/checkout builds the ephemeral refs/pull/N/merge commit, so
`git rev-parse HEAD` returns a SHA that is not in the PR's commit list and
means nothing to a reviewer. The artifact filename still carries that merge
SHA, so the two differ by design.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019LoLgW7oFjBPxGea9kiZJ2
The artifact filename carried the ephemeral refs/pull/N/merge SHA while
the comment footer carried head.sha, so a build showed two different
commits and neither the reader nor the PR's commit list could reconcile
them.

Resolves it at the source: the version step now reports head.sha on a
pull_request, falling back to the checked-out commit otherwise. Filename,
comment and the PR's commit list now agree.

Non-PR naming is unchanged - `--short` and `--short=8` both yield 8
characters in this repo, so release and dispatch artifacts keep the names
they have today.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019LoLgW7oFjBPxGea9kiZJ2
Without always(), a failed build left gha-build on the PR, and re-adding
a label that is already present emits no `labeled` event - so the trigger
was dead until someone removed it by hand. Happened once already.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019LoLgW7oFjBPxGea9kiZJ2
@pattonwebz
pattonwebz merged commit dc053c9 into develop Jul 24, 2026
14 checks passed
@pattonwebz
pattonwebz deleted the playground-link-action branch July 24, 2026 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant