Skip to content

Conversation

@dkotter
Copy link
Collaborator

@dkotter dkotter commented Oct 31, 2025

What?

Instead of having the Build Plugin Zip action being called from the Pull Request Comments action, separate those into two separate actions that are both triggered when a PR is opened.

Why?

I wanted to have the Pull Request Comments action always call the Build Plugin Zip action before proceeding so we could ensure the zip was built properly prior to adding a Playground testing comment to the PR. But as I've attempted to get this working now across a few different PRs, I've run into issues with this approach.

This mostly comes down to permissions (or lack thereof). I originally was using the pull_request_target event as our trigger, which gives higher permission levels to the action workflow. The problem here is when this is the event, GitHub uses the base branch as the reference instead of the PR branch. This meant the zip being built was always based on trunk and never the PR branch, effectively making it worthless.

I switched over to using pull_request and upped the permission level on the job and that seemed to work fine. But in my latest PR, getting permission errors again and from what I've been able to find out, it seems when a PR is opened from a fork, GitHub limits the permissions on that, no matter what permissions you have set in the job (could also be something else I'm doing wrong so open to other opinions here if I'm wrong on this).

How?

Instead of trying to continue to mess with permissions to figure this out, decided it was easiest to just split this into two separate workflows that both are triggered when a PR is opened. So now the Build Plugin Zip action is triggered on the pull_request event, meaning the zip will be built from the PR branch. And the Pull Request Comments action is again triggered from the pull_request_target event, giving it higher permissions to add the Playground testing comment to the PR.

Worth noting the one potential issue here is it's likely the Build Plugin Zip action will take longer than the Pull Request Comments action, meaning a testing comment will be added prior to the zip actually being done. I don't expect this to be an issue in real life, as we're talking just a minute or two difference, but did want to note that.

Testing Instructions

  1. Ensure the Playground testing comment is getting added to this PR description.
  2. Ensure both the Build Plugin Zip action and Pull Request Comments action succeed

Test using WordPress Playground

The changes in this pull request can be previewed and tested using this WordPress Playground instance:

Click here to test this pull request

@dkotter dkotter added this to the 0.1.0 milestone Oct 31, 2025
@dkotter dkotter self-assigned this Oct 31, 2025
@github-actions
Copy link

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: dkotter <[email protected]>

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

@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.48%. Comparing base (e76b0b2) to head (c1b0532).
⚠️ Report is 6 commits behind head on trunk.

Additional details and impacted files
@@            Coverage Diff            @@
##              trunk      #65   +/-   ##
=========================================
  Coverage     48.48%   48.48%           
  Complexity       45       45           
=========================================
  Files             6        6           
  Lines           198      198           
=========================================
  Hits             96       96           
  Misses          102      102           
Flag Coverage Δ
unit 48.48% <ø> (ø)

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

☔ View full report in Codecov by Sentry.
📢 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.

name: Build Plugin Zip

on:
workflow_call:
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to maintain the ability to call the build ZIP action manually from the Actions page (e.g. someone wanting to create a specific build from a specific branch)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs review

Development

Successfully merging this pull request may close these issues.

2 participants