Skip to content
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

Try/GitHub action playground comment #56964

Closed
wants to merge 16 commits into from
81 changes: 81 additions & 0 deletions .github/workflows/pull-request-playground-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Leaves a comment on a pull request with a link to test the changes in a WordPress Playground instance.
name: OPTIONAL - Comment on a pull request with Playground details

on:
pull_request:
types: [opened, synchronize]
# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
test_using_wordpress_playground:
name: Test using WordPress Playground
runs-on: ubuntu-latest
permissions:
pull-requests: write
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
steps:
- name: Find Comment
uses: peter-evans/find-comment@v2
id: find-comment
with:
issue-number: ${{ github.event.number }}
comment-author: 'github-actions[bot]'
body-includes: '<!-- pr-test-using=wordpress-playground -->'

- name: Create comment
if: steps.find-comment.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.number }}
body: |
<!-- pr-test-using=wordpress-playground -->
## Test this pull request with WordPress Playground

| :arrow_forward: **[Click here to load this PR into WordPress Playground](https://playground.wordpress.net/gutenberg.html?pr=56964)** |
| ------------- |

> [!TIP]
> _WordPress Playground uses the latest build of Gutenberg from this pull request. If your changes are not reflected in the Playground instance, it's likely that the most recent build isn't complete or has failed. Check the [build workflow runs to be sure](https://github.com/WordPress/gutenberg/actions/workflows/build-plugin-zip.yml)._

### About WordPress Playground

[WordPress Playground](https://developer.wordpress.org/playground/) is an experimental project allows you to run a full WordPress instance entirely in the browser.

#### Please note:
- A fresh instance is created each time you open Playground in the browser.
- **All changes will be lost** when refreshing the page or closing the window/tab running a Playground instance.
- The Plugin and Theme Directories cannot be accessed within Playground.

For more details about these limitations and more, check out [WordPress playground limitations](https://wordpress.github.io/wordpress-playground/limitations/) in the documentation.
- name: Update comment
if: steps.find-comment.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.number }}
edit-mode: replace
body: |
<!-- pr-test-using=wordpress-playground -->
## Test this pull request with WordPress Playground

| :arrow_forward: **[Click here to load this PR into WordPress Playground](https://playground.wordpress.net/gutenberg.html?pr=56964)** |
| ------------- |

> [!TIP]
> _WordPress Playground uses the latest build of Gutenberg from this pull request. If your changes are not reflected in the Playground instance, it's likely that the most recent build isn't complete or has failed. Check the [build workflow runs to be sure](https://github.com/WordPress/gutenberg/actions/workflows/build-plugin-zip.yml)._

### About WordPress Playground

[WordPress Playground](https://developer.wordpress.org/playground/) is an experimental project allows you to run a full WordPress instance entirely in the browser.

#### Please note:
- A fresh instance is created each time you open Playground in the browser.
- **All changes will be lost** when refreshing the page or closing the window/tab running a Playground instance.
- The Plugin and Theme Directories cannot be accessed within Playground.

For more details about these limitations and more, check out [WordPress playground limitations](https://wordpress.github.io/wordpress-playground/limitations/) in the documentation.
Loading