liatrio / terraform-change-pr-commenter

GitHub Action to read changes from Terraform plan JSON, summarize changes, and post them in a GitHub Pull Request Comment
Apache License 2.0
38 stars 8 forks source link

Update existing comment in place #57

Closed cdata closed 2 months ago

cdata commented 8 months ago

Hey, I love this thing! It's just what I needed.

It would be nice if the action updated the comment in place as actions are re-run for a given PR (maybe as a configurable option). Historical comments are a little interesting but mostly just noisy.

someshkoli commented 8 months ago

hey @cdata, you can do something like below. This will hide previous comments and give you a clean view. Updating existing comment is not the best idea as your commit and comment may get out of sync.

PS: ive been running a fork of this action with some added features.

      - uses: int128/hide-comment-action@v1
        with:
          contains: |
            Terraform Plan Summary: <b>${{ env.STACK }}</b>

      - uses: liatrio/terraform-change-pr-commenter@main
        with:
          json-file: tfplan.json
          expand-comment: "true"
          include-plan-job-summary: "true"
jburns24 commented 2 months ago

@cdata We have added a feature to v1.6.0 that will hide all previous comments made by this action to reduce the noise.

      - uses: liatrio/terraform-change-pr-commenter@v1.6.0
        with:
          json-file: envs/dev/plan.json
          hide-previous-comments: "true"

Which will result in a history like this

image

In testing I did notice that I had to refresh the tab for the minimize to take effect FYI.