Skip to content

✨😈☝️ pull request preview playground#666

Merged
mauteri merged 70 commits intoGatherPress:mainfrom
carstingaxion:feature/pull-request-preview-playground
Jul 29, 2024
Merged

✨😈☝️ pull request preview playground#666
mauteri merged 70 commits intoGatherPress:mainfrom
carstingaxion:feature/pull-request-preview-playground

Conversation

@carstingaxion
Copy link
Copy Markdown
Collaborator

@carstingaxion carstingaxion commented May 31, 2024

Description of the Change

grafik

Closes #

How to test the Change

Changelog Entry

Added - New automated comments with links to preview the current PR in WordPress Playground.

Credits

Props @carstingaxion

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@carstingaxion carstingaxion changed the title Feature/pull request preview playground ✨😈☝️ pull request preview playground May 31, 2024
@carstingaxion

This comment was marked as outdated.

@carstingaxion

This comment was marked as outdated.

@carstingaxion

This comment was marked as outdated.

@carstingaxion
Copy link
Copy Markdown
Collaborator Author

What and Why pull_request_target?

pull_request_target is one of the events triggering GitHub Actions workflows.
One of the differences between pull_request_target and pull_request is that pull_request_target triggers workflows based on the latest commit of the pull request's base branch.
Even if workflow files are modified or deleted on feature branches, workflows on the default branch aren't affected so you can prevent malicious code from being executed in CI without code review.

[...]

The GitHub Actions built in environment variables and Context of pull_request_target event are different from those of pull_request event.
For example, the following environment variables and context are different.

event_name, GITHUB_EVENT_NAME
ref, GITHUB_REF
sha, GITHUB_SHA
ref_name, GITHUB_REF_NAME

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Needs to be uploaded to gatherpress.org

└── playground-preview
    ├── .htaccess
    └── plugin-proxy.php

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.

@MervinHernandez you'll need to work with Carstin on this to get on gatherpress.org

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Needs to be uploaded to gatherpress.org

└── playground-preview
    ├── .htaccess
    └── plugin-proxy.php

*/
ini_set( 'display_errors', 0 );

putenv( 'GITHUB_TOKEN=___REPLACE_WITH_REAL_GITHUB_TOKEN___' );
Copy link
Copy Markdown
Collaborator Author

@carstingaxion carstingaxion Jul 28, 2024

Choose a reason for hiding this comment

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

Replace ___REPLACE_WITH_REAL_GITHUB_TOKEN___ with a working PAT (to comment on PRs).

Only in PRODUCTION on gatherpress.org, NOT here in the repo!

@carstingaxion
Copy link
Copy Markdown
Collaborator Author

carstingaxion commented Jul 29, 2024

Preview-Comment after last commit A new commit is added The Preview-Comment is deleted & recreated after the last commit
grafik grafik grafik

As the screenshots show: The playground PR previewer is ready and working!

I combined the versions 1 & 2 of this idea and closed #668 as not needed anymore.


Actually this is not yet running on the GatherPress/gatherpress repository, because the workflow needs to be part of the repo itself BEFORE it will run & work. That's why the log of the workflow run says

Error: Unhandled error: HttpError: Resource not accessible by integration

To circumvent this behaviour during development I created carstingaxion#21, which is the working example and origin of the screenshots.


Now I need and would appreciate some help from @MervinHernandez and/or @mauteri :

@carstingaxion carstingaxion marked this pull request as ready for review July 29, 2024 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants