Skip to content

Commit

Permalink
Update terraform_plan.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
arnol377 committed Aug 16, 2024
1 parent 8b593e1 commit ca06810
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions .github/workflows/terraform_plan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,50 +68,31 @@ jobs:

- name: Terraform Plan
id: plan
if: github.event_name == 'pull_request'
run: terraform plan -no-color -out=${{ vars.plan_cache }}/${{ github.sha }}
continue-on-error: true

- name: Terraform Plan
if: github.event_name != 'pull_request'
run: terraform plan -no-color
continue-on-error: true

- name: Terraform Show plan
if: github.event_name == 'pull_request'
run: echo ::set-output name=terraform_plan::$(terraform show ${{ vars.plan_cache }}/${{ github.sha }})

- name: Post Terraform Plan to PR
uses: CSVD/gh-actions-github-script@v6
- uses: CSVD/gh-actions-github-script@v6
if: github.event_name == 'pull_request'
env:
PLAN: "terraform\n${{ env.terraform_plan }}"
PLAN: "terraform\n${{ steps.plan.outputs.stdout }}"
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\`
#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\`
#### Terraform Validation 🤖\`${{ steps.validate.outcome }}\`
<details><summary>Validation Output</summary>
\`\`\`\n
${{ steps.validate.outputs.stdout }}
\`\`\`
</details>
#### Terraform Plan 📖\`${{ steps.plan.outcome }}\`
<details><summary>Show Plan</summary>
\`\`\`\n
${process.env.PLAN}
\`\`\`
</details>
*Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Workflow: \`${{ github.workflow }}\`*`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
Expand Down

0 comments on commit ca06810

Please sign in to comment.