Skip to content

Commit 3aa7e2f

Browse files
authored
Add fail-on-no-inputs tests (#79)
1 parent 92fc377 commit 3aa7e2f

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/selftest.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,46 @@ jobs:
167167
168168
[[ "${XFAIL}" == "true" ]] || { >&2 echo "expected step to fail"; exit 1; }
169169
170+
selftest-fail-on-no-inputs-xfail:
171+
name: "TEST: 'fail-on-no-inputs: true' causes failure when no inputs are collected"
172+
runs-on: ubuntu-latest
173+
steps:
174+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
175+
with:
176+
persist-credentials: false
177+
178+
- uses: ./
179+
id: zizmor
180+
continue-on-error: true
181+
with:
182+
advanced-security: false
183+
inputs: woodruffw-experiments/empty
184+
185+
- name: assert failure
186+
env:
187+
XFAIL: ${{ steps.zizmor.outcome == 'failure' }}
188+
JOB_NAME: ${{ github.job }}
189+
run: |
190+
echo "xfail ${JOB_NAME}: ${XFAIL}"
191+
192+
[[ "${XFAIL}" == "true" ]] || { >&2 echo "expected step to fail"; exit 1; }
193+
194+
selftest-fail-on-no-inputs-disabled:
195+
name: "TEST: 'fail-on-no-inputs: false' does not cause failure when no inputs are collected"
196+
runs-on: ubuntu-latest
197+
steps:
198+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
199+
with:
200+
persist-credentials: false
201+
202+
- uses: ./
203+
id: zizmor
204+
continue-on-error: true
205+
with:
206+
advanced-security: false
207+
inputs: woodruffw-experiments/empty
208+
fail-on-no-inputs: false
209+
170210
all-selftests-pass:
171211
if: always()
172212

@@ -179,6 +219,8 @@ jobs:
179219
- selftest-plain-gha-hazmat-offline-audits-xfail
180220
- selftest-annotations
181221
- selftest-annotations-advanced-security-exclusive-xfail
222+
- selftest-fail-on-no-inputs-xfail
223+
- selftest-fail-on-no-inputs-disabled
182224

183225
runs-on: ubuntu-latest
184226

0 commit comments

Comments
 (0)