-
Notifications
You must be signed in to change notification settings - Fork 43
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
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 @@
## develop #65 +/- ##
=============================================
- Coverage 31.46% 27.33% -4.14%
+ Complexity 176 152 -24
=============================================
Files 16 14 -2
Lines 1017 900 -117
=============================================
- Hits 320 246 -74
+ Misses 697 654 -43
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:
|
|
@dkotter any other updates you have planned here? If not, go ahead and merge in so we can start taking benefit of the work in these changes. |
Sorry for the delay in response here. I haven't forgotten this, just been focused on other things. This PR does fix the permissions issue we see when a PR is opened from a fork but I am still running into issues where the Playground environment seems to pull in old code instead of the code from the most recent commit. It feels like a caching thing on their end, as a few times now I've clicked on a Playground link and things I expected to see weren't there and then clicking the same link the next day, things worked. But I haven't had time to investigate things further to see if there are changes we need to make here to clear that cache out (or if I'm even correct on that assumption) |
|
Yes, I'll investigate this week. We now have a reusable action for these preview buttons that may help here. |
|
@dkotter I think we can probably punt this to v0.2.0 as its not critical for v0.1.0, yeah? |
Yep, this is not needed for v0.1.0 (or really any release for that matter) |
|
I got pulled away sadly and wasn't able to look into this yet. I might be able to next week. Otherwise, see the example repositories with that action already set up. |
Thanks for pointing this out. I've opened a new PR to try this out but at the moment, isn't running the second step. It builds the plugin zip fine but the |
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