Skip to content

Playground preview: derive PR from the triggering run - #978

Merged
obenland merged 1 commit into
developfrom
update/playground-preview-metadata
Aug 26, 2026
Merged

obenland merged 1 commit into
developfrom
update/playground-preview-metadata

Conversation

@obenland

@obenland obenland commented Aug 26, 2026 •

Copy link
Copy Markdown
Member

What

The privileged pr-playground-preview.yml publisher currently reads the PR number and commit SHA out of the build artifact's name (ai-plugin-zip-pr<n>-<sha>). This change instead:

  • Takes the head SHA from the workflow_run event (context.payload.workflow_run.head_sha).
  • Resolves the pull request by matching that SHA against open PRs' head SHAs.
  • Locates the build artifact by the exact name the trusted build derives from that PR and SHA, rather than by prefix.

The published preview and the comment target now follow from the commit that was actually built, not from artifact-supplied values.

Why

The build workflow runs on PR code with a read-only token; its artifacts (name and contents) are untrusted. Binding to the workflow_run head SHA keeps the publish step aligned with the triggering run.

Testing

  • actionlint clean; embedded github-script syntax-checked.
  • No producer change: the build already runs PR code by design, and the fix is entirely on the trusted consumer side.
  • Worth a check on a fork-originated PR to confirm the PR resolves in the runner.
Open WordPress Playground Preview

@obenland
obenland requested review from a team and a lite review from Copilot August 26, 2026 15:04
@obenland
obenland requested a review from jeffpaul as a code owner August 26, 2026 15:04

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@jeffpaul jeffpaul added this to the 1.4.0 milestone Aug 26, 2026
@jeffpaul jeffpaul moved this from Triage to Needs review in WordPress AI Roadmap Aug 26, 2026
@jeffpaul

Copy link
Copy Markdown
Member

Waiting to see that the generated playground env works before approving

The publish workflow takes the head SHA from the workflow_run event and
resolves the associated pull request through the API, rather than reading
the PR number and commit SHA back from the build artifact name. The build
artifact is located by the name the trusted build derives from that PR and
SHA, keeping the published preview aligned with the commit that was built.
@obenland
obenland force-pushed the update/playground-preview-metadata branch from cb7e579 to 3cecd11 Compare August 26, 2026 18:16
@github-actions

github-actions Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: obenland <obenland@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>
Co-authored-by: jeffpaul <jeffpaul@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

Copy link
Copy Markdown

✅ WordPress Plugin Check Report

✅ Status: Passed

📊 Report

All checks passed! No errors or warnings found.


🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

@obenland

Copy link
Copy Markdown
Member Author

@jeffpaul Looks like GH actions are back online

@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.57%. Comparing base (fc6bb2d) to head (3cecd11).

Additional details and impacted files
@@            Coverage Diff             @@
##             develop     #978   +/-   ##
==========================================
  Coverage      74.57%   74.57%           
  Complexity      3132     3132           
==========================================
  Files            132      132           
  Lines          12213    12213           
==========================================
  Hits            9108     9108           
  Misses          3105     3105           
Flag Coverage Δ
unit 74.57% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@obenland
obenland merged commit f5bade4 into develop Aug 26, 2026
32 of 33 checks passed
@obenland
obenland deleted the update/playground-preview-metadata branch August 26, 2026 18:31
@github-project-automation github-project-automation Bot moved this from Needs review to Done in WordPress AI Roadmap Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants