@@ -3,13 +3,18 @@ name: Test terraform-fmt-check
33on :
44 - pull_request
55
6+ permissions :
7+ contents : read
8+
69jobs :
710 canonical_fmt :
8- runs-on : ubuntu-latest
11+ runs-on : ubuntu-24.04
912 name : Canonical fmt
1013 steps :
1114 - name : Checkout
1215 uses : actions/checkout@v4
16+ with :
17+ persist-credentials : false
1318
1419 - name : fmt-check
1520 uses : ./terraform-fmt-check
@@ -18,19 +23,23 @@ jobs:
1823 path : tests/workflows/test-fmt-check/canonical
1924
2025 - name : Check valid
26+ env :
27+ FAILURE_REASON : ${{ steps.fmt-check.outputs.failure-reason }}
2128 run : |
22- if [[ "${{ steps.fmt-check.outputs.failure-reason }} " != "" ]]; then
29+ if [[ "$FAILURE_REASON " != "" ]]; then
2330 echo "::error:: failure-reason not set correctly"
2431 exit 1
2532 fi
2633
2734 non_canonical_fmt :
28- runs-on : ubuntu-latest
35+ runs-on : ubuntu-24.04
2936 name : Non canonical fmt
3037 continue-on-error : true
3138 steps :
3239 - name : Checkout
3340 uses : actions/checkout@v4
41+ with :
42+ persist-credentials : false
3443
3544 - name : fmt-check
3645 uses : ./terraform-fmt-check
@@ -40,13 +49,16 @@ jobs:
4049 path : tests/workflows/test-fmt-check/non-canonical
4150
4251 - name : Check invalid
52+ env :
53+ OUTCOME : ${{ steps.fmt-check.outcome }}
54+ FAILURE_REASON : ${{ steps.fmt-check.outputs.failure-reason }}
4355 run : |
44- if [[ "${{ steps.fmt-check.outcome }} " != "failure" ]]; then
56+ if [[ "$OUTCOME " != "failure" ]]; then
4557 echo "fmt-check did not fail correctly"
4658 exit 1
4759 fi
4860
49- if [[ "${{ steps.fmt-check.outputs.failure-reason }} " != "check-failed" ]]; then
61+ if [[ "$FAILURE_REASON " != "check-failed" ]]; then
5062 echo "::error:: failure-reason not set correctly"
5163 exit 1
5264 fi
0 commit comments