-
Notifications
You must be signed in to change notification settings - Fork 11
Separate the Build Plugin Zip action from the PR Comments action #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| name: Build Plugin Zip | ||
|
|
||
| on: | ||
| workflow_call: |
There was a problem hiding this comment.
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)?
What?
Instead of having the
Build Plugin Zipaction being called from thePull Request Commentsaction, separate those into two separate actions that are both triggered when a PR is opened.Why?
I wanted to have the
Pull Request Commentsaction always call theBuild Plugin Zipaction 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_targetevent 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 ontrunkand never the PR branch, effectively making it worthless.I switched over to using
pull_requestand 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 Zipaction is triggered on thepull_requestevent, meaning the zip will be built from the PR branch. And thePull Request Commentsaction is again triggered from thepull_request_targetevent, 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 Zipaction will take longer than thePull Request Commentsaction, 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
Build Plugin Zipaction andPull Request Commentsaction succeedTest 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