File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,27 +62,35 @@ jobs:
6262 tail -n 1000 plan-filtered.txt > plan-filtered-truncated.txt
6363 mv plan-filtered-truncated.txt plan-filtered.txt
6464
65- - name : Find existing comment
65+ - name : prepare-comment
66+ run : |
67+ {
68+ echo '<!-- opentofu-plan -->'
69+ echo '#### OpenTofu Plan'
70+ echo '```'
71+ cat plan-filtered.txt
72+ echo '```'
73+ } > comment-body.md
74+
75+ - name : find-comment
6676 uses : peter-evans/find-comment@v3
6777 id : fc
6878 with :
6979 issue-number : ${{ github.event.pull_request.number }}
7080 comment-author : ' github-actions[bot]'
7181 body-includes : ' <!-- opentofu-plan -->'
7282
73- - name : Comment PR with Plan
83+ - name : delete-comment
84+ if : steps.fc.outputs.comment-id != ''
85+ run : gh api repos/${{ github.repository }}/issues/comments/${{ steps.fc.outputs.comment-id }} -X DELETE
86+ env :
87+ GH_TOKEN : ${{ github.token }}
88+
89+ - name : comment
7490 uses : peter-evans/create-or-update-comment@v4
7591 with :
76- comment-id : ${{ steps.fc.outputs.comment-id }}
7792 issue-number : ${{ github.event.pull_request.number }}
78- body-path : plan-filtered.txt
79- body-prefix : |
80- <!-- opentofu-plan -->
81- #### OpenTofu Plan
82- ```
83- body-suffix : |
84- ```
85- edit-mode : replace
93+ body-path : comment-body.md
8694
8795 apply :
8896 name : OpenTofu Apply
You can’t perform that action at this time.
0 commit comments