From c7c4dbeed6198f23ddaddf755856737918f6a856 Mon Sep 17 00:00:00 2001 From: Daniel Naab Date: Tue, 18 Jun 2024 22:56:01 -0500 Subject: [PATCH] Lookup prior comment --- .github/workflows/_terraform-plan-pr-comment.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/_terraform-plan-pr-comment.yml b/.github/workflows/_terraform-plan-pr-comment.yml index 6be4d482..eae92f8a 100644 --- a/.github/workflows/_terraform-plan-pr-comment.yml +++ b/.github/workflows/_terraform-plan-pr-comment.yml @@ -79,15 +79,25 @@ jobs: echo "::set-output name=stdout::$output" working-directory: infra + - name: Find Comment + uses: peter-evans/find-comment@v3 + id: find_comment + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: 'github-actions[bot]' + body-includes: '' + - name: Create or update PR comment with Terraform plan uses: peter-evans/create-or-update-comment@v4 with: + comment-id: ${{ steps.find_comment.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} token: ${{ secrets.GITHUB_TOKEN }} repository: ${{ github.repository }} - issue-number: ${{ github.event.pull_request.number }} body: | **Terraform Plan** ```terraform ${{ steps.show_plan.outputs.stdout }} ``` + edit-mode: replace