From 4cd6dd7602ea62976945db0e63d2eab8354a3932 Mon Sep 17 00:00:00 2001 From: arnol377 Date: Thu, 27 Mar 2025 17:32:14 -0400 Subject: [PATCH] fix: streamline output handling and control flow in Terraform Validate action --- action.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index d49456e..f8a383a 100644 --- a/action.yml +++ b/action.yml @@ -48,7 +48,6 @@ runs: if [[ $VALIDATE_EXIT_CODE -ne 0 ]]; then echo "Terraform validation failed" echo "is_valid=false" >> $GITHUB_OUTPUT - exit $VALIDATE_EXIT_CODE else echo "Terraform validation passed" echo "is_valid=true" >> $GITHUB_OUTPUT @@ -57,7 +56,6 @@ runs: - name: Terraform Test id: test shell: bash - if: steps.validate.outcome == 'success' run: | cd ${{ inputs.working-directory }} terraform test @@ -70,9 +68,10 @@ runs: echo "tests_passed=true" >> $GITHUB_OUTPUT fi - - name: Set Outputs + - name: Set Final Outputs id: set_outputs shell: bash run: | - echo "is_valid=$(cat $GITHUB_OUTPUT | grep is_valid | cut -d= -f2)" >> $GITHUB_OUTPUT - echo "tests_passed=$(cat $GITHUB_OUTPUT | grep tests_passed | cut -d= -f2)" >> $GITHUB_OUTPUT \ No newline at end of file + echo "is_valid=${{ steps.validate.outputs.is_valid || 'false' }}" >> $GITHUB_OUTPUT + echo "tests_passed=${{ steps.test.outputs.tests_passed || 'false' }}" >> $GITHUB_OUTPUT + echo "stdout=Successfully ran terraform validate and test" >> $GITHUB_OUTPUT \ No newline at end of file