1212 name : Test
1313 runs-on : ubuntu-latest
1414 steps :
15+ - name : Checkout
16+ uses : actions/checkout@v5
17+ with :
18+ fetch-depth : 0
19+ ref : ${{ github.event.pull_request.head.sha || github.sha }}
20+
1521 - name : Setup Terraform
1622 uses : hashicorp/setup-terraform@v3
1723 with :
5561 steps :
5662 - name : Checkout
5763 uses : actions/checkout@v5
64+ with :
65+ fetch-depth : 0
66+ ref : ${{ github.event.pull_request.head.sha || github.sha }}
5867
5968 - name : Get root directories
6069 id : dirs
6776 strategy :
6877 matrix :
6978 directory : ${{ fromJson(needs.collectInputs.outputs.directories) }}
79+
7080 steps :
71- # https://github.com/orgs/community/discussions/25678#discussioncomment-5242449
7281 - name : Delete huge unnecessary tools folder
7382 run : |
7483 rm -rf /opt/hostedtoolcache/CodeQL
@@ -78,24 +87,25 @@ jobs:
7887
7988 - name : Checkout
8089 uses : actions/checkout@v5
90+ with :
91+ fetch-depth : 0
92+ ref : ${{ github.event.pull_request.head.sha || github.sha }}
8193
8294 - name : Terraform min/max versions
8395 id : minMax
84968597 with :
8698 directory : ${{ matrix.directory }}
8799 - name : Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
88- # Run only validate pre-commit check on min version supported
89- if : ${{ matrix.directory != '.' }}
100+ if : ${{ matrix.directory != '.' }}
90101 uses :
clowdhaus/terraform-composite-actions/[email protected] 91102 with :
92103 terraform-version : ${{ steps.minMax.outputs.minVersion }}
93104 tflint-version : ${{ env.TFLINT_VERSION }}
94105 args : ' terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'
95106
96107 - name : Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
97- # Run only validate pre-commit check on min version supported
98- if : ${{ matrix.directory == '.' }}
108+ if : ${{ matrix.directory == '.' }}
99109 uses :
clowdhaus/terraform-composite-actions/[email protected] 100110 with :
101111 terraform-version : ${{ steps.minMax.outputs.minVersion }}
@@ -107,7 +117,6 @@ jobs:
107117 runs-on : ubuntu-latest
108118 needs : collectInputs
109119 steps :
110- # https://github.com/orgs/community/discussions/25678#discussioncomment-5242449
111120 - name : Delete huge unnecessary tools folder
112121 run : |
113122 rm -rf /opt/hostedtoolcache/CodeQL
@@ -118,8 +127,8 @@ jobs:
118127 - name : Checkout
119128 uses : actions/checkout@v5
120129 with :
121- ref : ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
122- token : ${{ secrets.GITHUB_TOKEN }}
130+ fetch-depth : 0
131+ ref : ${{ github.event.pull_request.head.sha || github.sha }}
123132
124133 - name : Terraform min/max versions
125134 id : minMax
0 commit comments