From 03745775f62d01f2b858cfe9530b760c01ef3330 Mon Sep 17 00:00:00 2001 From: sid palas Date: Thu, 27 May 2021 14:48:41 -0700 Subject: [PATCH] add tf plan step --- .github/workflows/terraform.yml | 58 ++++++++++++++++----------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index 3711100..b0fb912 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -33,43 +33,43 @@ jobs: id: init run: terraform init - # - name: Terraform Plan - # id: plan - # if: github.event_name == 'pull_request' - # run: terraform plan -no-color - # continue-on-error: true + - name: Terraform Plan + id: plan + if: github.event_name == 'pull_request' + run: terraform plan -no-color + continue-on-error: true - # - uses: actions/github-script@0.9.0 - # if: github.event_name == 'pull_request' - # env: - # PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" - # with: - # github-token: ${{ secrets.GITHUB_TOKEN }} - # script: | - # const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\` - # #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` - # #### Terraform Plan 📖\`${{ steps.plan.outcome }}\` + - uses: actions/github-script@0.9.0 + if: github.event_name == 'pull_request' + env: + PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\` + #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` + #### Terraform Plan 📖\`${{ steps.plan.outcome }}\` - #
Show Plan +
Show Plan - # \`\`\`${process.env.PLAN}\`\`\` + \`\`\`${process.env.PLAN}\`\`\` - #
+
- # *Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; + *Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; - # github.issues.createComment({ - # issue_number: context.issue.number, - # owner: context.repo.owner, - # repo: context.repo.repo, - # body: output - # }) + github.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: output + }) - # - name: Terraform Plan Status - # if: steps.plan.outcome == 'failure' - # run: exit 1 + - name: Terraform Plan Status + if: steps.plan.outcome == 'failure' + run: exit 1 # - name: Terraform Apply - # if: github.ref == 'refs/heads/master' && github.event_name == 'push' + # if: github.ref == 'refs/heads/main' && github.event_name == 'push' # run: terraform apply -auto-approve \ No newline at end of file