mirrored from git://develop.git.wordpress.org/
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Post a Playground link on every PR using the pull_request_target workflow #5737
Closed
adamziel
wants to merge
14
commits into
WordPress:trunk
from
adamziel:update-playground-comment-workflow
Closed
Post a Playground link on every PR using the pull_request_target workflow #5737
adamziel
wants to merge
14
commits into
WordPress:trunk
from
adamziel:update-playground-comment-workflow
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…kflow method called in test-build-processes.yml
Fix post playground message
… the purposes of this fork
This was referenced Dec 8, 2023
adamziel
changed the title
Post a Playground link on every PR using the pull_request workflow
Post a Playground link on every PR using the pull_request_target workflow
Dec 10, 2023
…e original changes
cc @ockham |
ockham
approved these changes
Dec 10, 2023
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.
LGTM; let's hope it's gonna take 🤞
Thank you for also exploring the alternatives you mentioned!
adamziel
added a commit
to adamziel/wordpress-develop
that referenced
this pull request
Dec 10, 2023
This PR exists to test the user experience of previewing WordPress Pull Requests. See WordPress#5737 Ticket: 59416
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follows up on #5526
Related:
Updates the
pull-request-comments.yml
workflow to post the Playground comment on thepull_request_target
trigger, not on theworkflow_dispatch
trigger.Here's how it works in my fork: adamziel#11
The previous attempt leaned on workflow_dispatch. The goal was to only post a comment once the build workflow creates the
wordpress.zip
artifact required by the PR previewer. However,workflow_dispatch
seems to have less permissions than thepull_request_target
trigger. The workflows dispatched that way fail with a 403 error and the following error message:Since there doesn't seem to be a straightforward way to only post the comment when the build artifact is ready, I propose posting it immediately and then handling the UX on the PR previewer side. It could display a progress indicator and say "That Pull Request is still being built on GitHub, you'll be redirected to the preview as soon as it's ready!"
See how the commenting workflow failed on all these PRs:
Testing instructions
Security implications
The
playground-details
workflow follows the pattern established by thepost-welcome-message
workflow:pull_request_target
trigger on thetrunk
branch.if
condition andpermissions
clause.Therefore, it shouldn't introduce any security risks.
Alternatives considered
Passing the GITHUB_TOKEN via
inputs
The following dispatch call worked in my private fork, which made me hopeful. However, if I ran it without passing the
github_token
, it also worked. This is the how the original 403 error got merged via PR #5526. We would have to essentially merge this change and test it in production, which I'm not too excited about.Moving the commenting action to the same workflow as the build jobs
The job responsible for commenting could be moved into
test-build-processes.yml
and run after the build workflows, avoiding this entire conundrum. However, a large point of splitting the jobs into multiple files, was to maintain the separation between the build jobs and the commenting jobs. Therefore, I propose to keep these separate.Using
on: workflow_run
@swissspidy proposed the following trigger in #5738:
Unfortunately, I could not get that to run on my fork. I suspect this might be related to this note in the workflows documentation:
https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
Before merging
Let's do the reviewing and approving here, but let's hold off with merging until the related progress indicator work is shipped in the WordPress Playground repo.The required changes in Playground were merged in WordPress/wordpress-playground#853
Trac Ticket: https://core.trac.wordpress.org/ticket/59416.
cc @desrosj @swissspidy