Skip to content

Commit a9cede8

Browse files
feat: add preflight validation step for workflow inputs in end-to-end testing
1 parent 527c29e commit a9cede8

8 files changed

Lines changed: 82 additions & 16 deletions

.github/workflows/e2e-action-commit-push.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ permissions:
3333
contents: write
3434

3535
jobs:
36-
basic-commit:
37-
name: Basic commit and push to new branch
36+
preflight:
37+
name: Validate workflow inputs
3838
runs-on: ubuntu-latest
3939
steps:
4040
- name: Validate mode input
@@ -47,6 +47,11 @@ jobs:
4747
;;
4848
esac
4949
50+
basic-commit:
51+
name: Basic commit and push to new branch
52+
needs: [preflight]
53+
runs-on: ubuntu-latest
54+
steps:
5055
- name: Checkout repository
5156
uses: actions/checkout@v6
5257
with:
@@ -88,6 +93,7 @@ jobs:
8893

8994
commit-with-prefix-message:
9095
name: Commit with custom prefix and message
96+
needs: [preflight]
9197
runs-on: ubuntu-latest
9298
steps:
9399
- name: Checkout repository
@@ -132,6 +138,7 @@ jobs:
132138

133139
allow-empty-commit:
134140
name: Allow empty commit with no file changes
141+
needs: [preflight]
135142
runs-on: ubuntu-latest
136143
steps:
137144
- name: Checkout repository
@@ -171,6 +178,7 @@ jobs:
171178

172179
commit-with-timestamp-branch:
173180
name: Commit to timestamped branch name
181+
needs: [preflight]
174182
runs-on: ubuntu-latest
175183
steps:
176184
- name: Checkout repository
@@ -218,6 +226,7 @@ jobs:
218226
219227
commit-with-repository-path:
220228
name: Commit from custom repository_path
229+
needs: [preflight]
221230
runs-on: ubuntu-latest
222231
steps:
223232
- name: Checkout repository into custom path
@@ -264,6 +273,7 @@ jobs:
264273

265274
reset-target-branch-to-base:
266275
name: Reset target branch to base branch
276+
needs: [preflight]
267277
runs-on: ubuntu-latest
268278
steps:
269279
- name: Checkout repository
@@ -331,6 +341,7 @@ jobs:
331341
332342
rebase-conflict-fails-when-strict:
333343
name: Rebase conflict fails when fail_on_rebase_conflict=true
344+
needs: [preflight]
334345
runs-on: ubuntu-latest
335346
steps:
336347
- name: Checkout repository
@@ -398,6 +409,7 @@ jobs:
398409
399410
amend-commit:
400411
name: Amend previous commit with force-with-lease
412+
needs: [preflight]
401413
runs-on: ubuntu-latest
402414
steps:
403415
- name: Checkout repository

.github/workflows/e2e-action-container-structure-test.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ permissions:
3333
contents: read
3434

3535
jobs:
36-
text-output:
37-
name: Basic test with text output format
36+
preflight:
37+
name: Validate workflow inputs
3838
runs-on: ubuntu-latest
3939
steps:
4040
- name: Validate mode input
@@ -47,6 +47,11 @@ jobs:
4747
;;
4848
esac
4949
50+
text-output:
51+
name: Basic test with text output format
52+
needs: [preflight]
53+
runs-on: ubuntu-latest
54+
steps:
5055
- name: Checkout repository
5156
uses: actions/checkout@v6
5257

@@ -84,6 +89,7 @@ jobs:
8489
8590
json-output:
8691
name: Test with JSON output format
92+
needs: [preflight]
8793
runs-on: ubuntu-latest
8894
steps:
8995
- name: Checkout repository
@@ -121,6 +127,7 @@ jobs:
121127
122128
junit-output:
123129
name: Test with JUnit output format and suite name
130+
needs: [preflight]
124131
runs-on: ubuntu-latest
125132
steps:
126133
- name: Checkout repository
@@ -159,6 +166,7 @@ jobs:
159166
160167
test-report-file:
161168
name: Test with report written to file
169+
needs: [preflight]
162170
runs-on: ubuntu-latest
163171
steps:
164172
- name: Checkout repository
@@ -201,6 +209,7 @@ jobs:
201209
202210
multiple-config-files:
203211
name: Test with multiple config files
212+
needs: [preflight]
204213
runs-on: ubuntu-latest
205214
steps:
206215
- name: Checkout repository
@@ -242,6 +251,7 @@ jobs:
242251
243252
metadata-platform-runtime:
244253
name: Test with metadata, platform, and runtime inputs
254+
needs: [preflight]
245255
runs-on: ubuntu-latest
246256
steps:
247257
- name: Checkout repository

.github/workflows/e2e-action-format-hcl.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ permissions:
3333
contents: read
3434

3535
jobs:
36-
format-check-clean-files:
37-
name: Check mode on already-formatted files passes
36+
preflight:
37+
name: Validate workflow inputs
3838
runs-on: ubuntu-latest
3939
steps:
4040
- name: Validate mode input
@@ -47,6 +47,11 @@ jobs:
4747
;;
4848
esac
4949
50+
format-check-clean-files:
51+
name: Check mode on already-formatted files passes
52+
needs: [preflight]
53+
runs-on: ubuntu-latest
54+
steps:
5055
- name: Checkout repository
5156
uses: actions/checkout@v6
5257

@@ -100,6 +105,7 @@ jobs:
100105
101106
format-write-mode:
102107
name: Write mode formats and rewrites files
108+
needs: [preflight]
103109
runs-on: ubuntu-latest
104110
steps:
105111
- name: Checkout repository
@@ -160,6 +166,7 @@ jobs:
160166

161167
format-check-malformed-files:
162168
name: Check mode on malformed files reports failure
169+
needs: [preflight]
163170
runs-on: ubuntu-latest
164171
steps:
165172
- name: Checkout repository
@@ -206,6 +213,7 @@ jobs:
206213

207214
format-list-with-diff:
208215
name: List and diff mode on formatted files
216+
needs: [preflight]
209217
runs-on: ubuntu-latest
210218
steps:
211219
- name: Checkout repository

.github/workflows/e2e-action-pull-request.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ permissions:
3535
issues: write
3636

3737
jobs:
38-
basic-pull-request:
39-
name: Basic pull request creation
38+
preflight:
39+
name: Validate workflow inputs
4040
runs-on: ubuntu-latest
4141
steps:
4242
- name: Validate mode input
@@ -49,6 +49,11 @@ jobs:
4949
;;
5050
esac
5151
52+
basic-pull-request:
53+
name: Basic pull request creation
54+
needs: [preflight]
55+
runs-on: ubuntu-latest
56+
steps:
5257
- name: Checkout repository
5358
uses: actions/checkout@v6
5459
with:
@@ -106,6 +111,7 @@ jobs:
106111
107112
pull-request-with-title-body:
108113
name: Pull request with custom title and body
114+
needs: [preflight]
109115
runs-on: ubuntu-latest
110116
steps:
111117
- name: Checkout repository
@@ -169,6 +175,7 @@ jobs:
169175
170176
pull-request-with-repository-path:
171177
name: Pull request using custom checkout path and explicit repository
178+
needs: [preflight]
172179
runs-on: ubuntu-latest
173180
steps:
174181
- name: Checkout repository into custom path
@@ -233,6 +240,7 @@ jobs:
233240
234241
pull-request-draft-with-diff:
235242
name: Draft pull request with get_diff enabled
243+
needs: [preflight]
236244
runs-on: ubuntu-latest
237245
steps:
238246
- name: Checkout repository

.github/workflows/e2e-action-template-action.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ permissions:
3333
contents: read
3434

3535
jobs:
36-
template-action-input-output:
37-
name: Validate template-action input/output contract
36+
preflight:
37+
name: Validate workflow inputs
3838
runs-on: ubuntu-latest
3939
steps:
4040
- name: Validate mode input
@@ -47,6 +47,11 @@ jobs:
4747
;;
4848
esac
4949
50+
template-action-input-output:
51+
name: Validate template-action input/output contract
52+
needs: [preflight]
53+
runs-on: ubuntu-latest
54+
steps:
5055
- name: Run template action in ref mode
5156
if: ${{ inputs.mode == 'ref' }}
5257
id: action
@@ -73,6 +78,7 @@ jobs:
7378
7479
template-action-debug:
7580
name: Validate template-action debug mode
81+
needs: [preflight]
7682
runs-on: ubuntu-latest
7783
steps:
7884
- name: Run template action with debug enabled

.github/workflows/e2e-action-terraform-copy-vars.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ permissions:
3333
contents: read
3434

3535
jobs:
36-
basic-copy-vars:
37-
name: Copy variables from central file to modules
36+
preflight:
37+
name: Validate workflow inputs
3838
runs-on: ubuntu-latest
3939
steps:
4040
- name: Validate mode input
@@ -47,6 +47,11 @@ jobs:
4747
;;
4848
esac
4949
50+
basic-copy-vars:
51+
name: Copy variables from central file to modules
52+
needs: [preflight]
53+
runs-on: ubuntu-latest
54+
steps:
5055
- name: Checkout repository
5156
uses: actions/checkout@v6
5257

@@ -127,6 +132,7 @@ jobs:
127132

128133
copy-vars-custom-paths:
129134
name: Copy variables with custom directory and file paths
135+
needs: [preflight]
130136
runs-on: ubuntu-latest
131137
steps:
132138
- name: Checkout repository
@@ -202,6 +208,7 @@ jobs:
202208

203209
copy-vars-fail-on-missing:
204210
name: Fail when module uses variable missing from central file
211+
needs: [preflight]
205212
runs-on: ubuntu-latest
206213
steps:
207214
- name: Checkout repository

.github/workflows/e2e-action-terraform-validate.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ permissions:
3333
contents: read
3434

3535
jobs:
36-
validate-basic:
37-
name: Validate valid Terraform configuration
36+
preflight:
37+
name: Validate workflow inputs
3838
runs-on: ubuntu-latest
3939
steps:
4040
- name: Validate mode input
@@ -47,6 +47,11 @@ jobs:
4747
;;
4848
esac
4949
50+
validate-basic:
51+
name: Validate valid Terraform configuration
52+
needs: [preflight]
53+
runs-on: ubuntu-latest
54+
steps:
5055
- name: Checkout repository
5156
uses: actions/checkout@v6
5257

@@ -98,6 +103,7 @@ jobs:
98103
99104
validate-with-dir-filter:
100105
name: Validate with explicit directory filter
106+
needs: [preflight]
101107
runs-on: ubuntu-latest
102108
steps:
103109
- name: Checkout repository

.github/workflows/e2e-action-tflint.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ permissions:
3333
contents: read
3434

3535
jobs:
36-
basic-tflint:
37-
name: Basic TFLint on valid Terraform files
36+
preflight:
37+
name: Validate workflow inputs
3838
runs-on: ubuntu-latest
3939
steps:
4040
- name: Validate mode input
@@ -47,6 +47,11 @@ jobs:
4747
;;
4848
esac
4949
50+
basic-tflint:
51+
name: Basic TFLint on valid Terraform files
52+
needs: [preflight]
53+
runs-on: ubuntu-latest
54+
steps:
5055
- name: Checkout repository
5156
uses: actions/checkout@v6
5257

@@ -96,6 +101,7 @@ jobs:
96101
97102
tflint-with-dir-filter:
98103
name: TFLint with specific directory filter
104+
needs: [preflight]
99105
runs-on: ubuntu-latest
100106
steps:
101107
- name: Checkout repository
@@ -156,6 +162,7 @@ jobs:
156162
157163
tflint-no-fail-on-changes:
158164
name: TFLint with fail_on_changes disabled
165+
needs: [preflight]
159166
runs-on: ubuntu-latest
160167
steps:
161168
- name: Checkout repository
@@ -205,6 +212,7 @@ jobs:
205212
206213
tflint-with-custom-config:
207214
name: TFLint with explicit tflint_config
215+
needs: [preflight]
208216
runs-on: ubuntu-latest
209217
steps:
210218
- name: Checkout repository
@@ -264,6 +272,7 @@ jobs:
264272
265273
tflint-with-custom-params:
266274
name: TFLint with custom tflint_params
275+
needs: [preflight]
267276
runs-on: ubuntu-latest
268277
steps:
269278
- name: Checkout repository

0 commit comments

Comments
 (0)