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 9, 2024
1 parent e77cf74 commit 9198eed
Showing 1 changed file with 16 additions and 42 deletions.
58 changes: 16 additions & 42 deletions .github/workflows/terraform-plan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,58 +33,32 @@ jobs:
with:
terraform_wrapper: false

- name: Terraform fmt
- name: Terraform Format
id: fmt
run: terraform fmt
continue-on-error: true
run: |
terraform fmt
if ! git diff-index --quiet HEAD; then
git config --global user.name '${{ github.event.pull_request.user.login }}'
git config --global user.email 'github-actions@census.gov'
git commit -am "Autoformatting TF Code"
git push
echo "auto_format=true" >> $GITHUB_ENV
fi
- name: Autoformat Halt
if: env.auto_format == 'true'
run: exit 1

- name: Terraform Init
id: init
run: terraform init -upgrade

- name: Terraform Validate
id: validate
run: terraform validate -no-color
run: terraform validate

- name: Terraform Plan
id: plan
run: terraform plan -no-color
run: terraform plan
continue-on-error: true

# - uses: CSVD/gh-actions-github-script@v6
# if: github.event_name == 'pull_request'
# env:
# 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 }}\`, Working Directory: \`${{ env.tf_actions_working_dir }}\`, Workflow: \`${{ github.workflow }}\`*`;

# github.rest.issues.createComment({
# issue_number: context.issue.number,
# owner: context.repo.owner,
# repo: context.repo.repo,
# body: output
# })

0 comments on commit 9198eed

Please sign in to comment.