Created
July 1, 2021 19:58
-
-
Save figadore/128c8c37b1a292f9416e60ea6ba386dd to your computer and use it in GitHub Desktop.
Non-spammy terraform plan comments for PRs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: TF init | |
run: terraform init | |
- name: TF plan (color) | |
run: terraform plan -var-file=prod.tfvars -out=planfile | |
- name: Show plan (no color) | |
id: plan | |
run: terraform show -no-color planfile | |
- name: Find Comment | |
uses: peter-evans/find-comment@v1 | |
id: fc | |
if: github.event_name == 'pull_request' | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: Terraform Plan | |
- name: Create or update comment | |
uses: peter-evans/create-or-update-comment@v1 | |
if: github.event_name == 'pull_request' | |
with: | |
comment-id: ${{ steps.fc.outputs.comment-id }} | |
issue-number: ${{ github.event.pull_request.number }} | |
body: | | |
Terraform Plan | |
<details><summary>Show Plan</summary> | |
``` | |
${{ steps.plan.outputs.stdout }} | |
``` | |
</details> | |
edit-mode: replace |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment