From 40e536be45ab084bf371e9b733b3760df2d60594 Mon Sep 17 00:00:00 2001 From: costdev Date: Fri, 8 Nov 2024 03:25:32 +0000 Subject: [PATCH] Workflows: Add a Playground comment to new PRs. --- .../workflows/add-pr-playground-comment.yml | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/add-pr-playground-comment.yml diff --git a/.github/workflows/add-pr-playground-comment.yml b/.github/workflows/add-pr-playground-comment.yml new file mode 100644 index 0000000..5fc17a9 --- /dev/null +++ b/.github/workflows/add-pr-playground-comment.yml @@ -0,0 +1,29 @@ +name: Add PR Playground Comment + +on: + pull_request: + types: [opened] # Trigger when a PR is first opened + +jobs: + comment-pr: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Read and Base64 encode blueprint.json + id: encode_blueprint + run: | + # Read the content of blueprint.json and base64 encode it + encoded=$(base64 -w 0 assets/playground/blueprint.json) + echo "Encoded Blueprint: $encoded" + echo "encoded=$encoded" >> $GITHUB_ENV + + - name: Add PR comment + uses: peter-evans/create-or-update-comment@v2 + with: + issue-number: ${{ github.event.pull_request.number }} + body: | + A link to the playground with the base64-encoded blueprint is available: + [Playground Link](https://playground.wordpress.net/#${{ env.encoded }})