Skip to content

Commit

Permalink
add tf plan step
Browse files Browse the repository at this point in the history
  • Loading branch information
sidpalas committed May 27, 2021
1 parent b6c5b3c commit 0374577
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}\`
# <details><summary>Show Plan</summary>
<details><summary>Show Plan</summary>
# \`\`\`${process.env.PLAN}\`\`\`
\`\`\`${process.env.PLAN}\`\`\`
# </details>
</details>
# *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

0 comments on commit 0374577

Please sign in to comment.