From 91d9b3a397f939ee16fba060821fcce69eef775e Mon Sep 17 00:00:00 2001 From: Adam Yeats Date: Thu, 21 Sep 2023 14:18:22 +0200 Subject: [PATCH] Find and replace existing comment when creating a PR build --- .github/workflows/pull-request-image.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/pull-request-image.yml b/.github/workflows/pull-request-image.yml index 426d80b3..df085c90 100644 --- a/.github/workflows/pull-request-image.yml +++ b/.github/workflows/pull-request-image.yml @@ -99,7 +99,25 @@ jobs: runs-on: ubuntu-latest needs: push_to_registry steps: + - name: Find previous comment (if any) + uses: peter-evans/find-comment@v2 + id: fc + with: + issue-number: 1 + body-includes: Use the following command to run this PR with Docker + - name: Update comment on PR + if: steps.fc.outputs.comment-id != '' + uses: peter-evans/create-or-update-comment@v3 + with: + issue-number: ${{ github.event.number }} + body: | + Use the following command to run this PR with Docker at http://localhost:3000: + + ``` + docker run --rm -p 3000:3000 grafana/plugin-builds:${{ github.event.pull_request.head.sha }}pre + ``` - name: Add comment to PR + if: steps.fc.outputs.comment-id == '' uses: peter-evans/create-or-update-comment@v3 with: issue-number: ${{ github.event.number }}