From b8ea0dacbd9fa82ae48e3b9a244f50d1f8d61d6b Mon Sep 17 00:00:00 2001 From: Theo Chupp Date: Mon, 11 Apr 2022 09:33:05 -0400 Subject: [PATCH] feat: support requiring formatting (#13) --- action.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/action.yml b/action.yml index 3f343be..466b094 100644 --- a/action.yml +++ b/action.yml @@ -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: @@ -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