Skip to content

Commit

Permalink
feat: support requiring formatting (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
tchupp committed Apr 11, 2022
1 parent e50d307 commit b8ea0da
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ inputs:
description: "Should we use a workspace lock for the `terraform plan`? https://www.terraform.io/language/state/locking"
required: false
default: true
require-formatting:
description: "Should we require the terraform formatting check?"
required: false
default: false
runs:
using: "composite"
steps:
Expand Down Expand Up @@ -161,6 +165,17 @@ runs:
shell: bash
run: |
if [[ '${{ steps.plan.outputs.plan-outcome }}' == 'failure' ]]; then
echo ${{ steps.plan.outputs.stdout }}
echo ${{ steps.plan.outputs.stderr }}
exit 1
fi
- name: Terraform Format Status
shell: bash
run: |
if [[ '${{ inputs.require-formatting }}' == 'true' ]] && [[ '${{ steps.fmt.outputs.plan-outcome }}' == 'failure' ]]; then
echo ${{ steps.fmt.outputs.stdout }}
echo ${{ steps.fmt.outputs.stderr }}
exit 1
fi
Expand Down

0 comments on commit b8ea0da

Please sign in to comment.