File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -263,6 +263,19 @@ See the [Configuration - Discovery] documentation for how explicit configuration
263263
264264[Configuration - Discovery] : https://docs.zizmor.sh/configuration/#discovery
265265
266+ # ## `fail-on-no-inputs`
267+
268+ *Default*: `true`
269+
270+ ` fail-on-no-inputs` controls whether the action fails if no inputs
271+ were collected by `zizmor`. If set to `false`, the action will
272+ succeed even if no inputs were found.
273+
274+ > [!IMPORTANT]
275+ > This input only works with `zizmor v1.21.0` and later. It has no effect
276+ > on earlier versions of `zizmor`, meaning that the action will always fail
277+ > if no inputs are found on earlier versions.
278+
266279# # Permissions
267280
268281` zizmor-action` requires different permissions depending on how you use it.
Original file line number Diff line number Diff line change 22
33# action.sh: run zizmor via Docker
44
5- set -euo pipefail
5+ set -eu
66
77dbg () {
88 echo " ::debug::${* } "
@@ -106,3 +106,13 @@ docker run \
106106 -- \
107107 ${GHA_ZIZMOR_INPUTS} \
108108 | tee " ${output} "
109+
110+ exitcode=" ${PIPESTATUS[0]} "
111+ dbg " zizmor exited with code ${exitcode} "
112+
113+ if [[ " ${exitcode} " -eq 3 ]]; then
114+ warn " No inputs were collected by zizmor"
115+ [[ " ${GHA_ZIZMOR_FAIL_ON_NO_INPUTS} " = " false" ]] && exit 0
116+ fi
117+
118+ exit " ${exitcode} "
Original file line number Diff line number Diff line change @@ -73,7 +73,18 @@ inputs:
7373 config :
7474 description : Path to a custom zizmor configuration file Path (e.g., zizmor.yml).
7575 required : false
76+ fail-on-no-inputs :
77+ description : |
78+ Whether the action should fail if no inputs are collected by zizmor.
79+
80+ By default, zizmor will fail if it couldn't collect any inputs to audit.
81+ Setting this option to `false` will make the action succeed in such cases,
82+ with a warning message instead.
7683
84+ This input only works with zizmor v1.21.0 and later. Earlier versions
85+ will always fail on no inputs.
86+ required : false
87+ default : " true"
7788
7889runs :
7990 using : composite
94105 GHA_ZIZMOR_COLOR : ${{ inputs.color }}
95106 GHA_ZIZMOR_ANNOTATIONS : ${{ inputs.annotations }}
96107 GHA_ZIZMOR_CONFIG : ${{ inputs.config }}
108+ GHA_ZIZMOR_FAIL_ON_NO_INPUTS : ${{ inputs.fail-on-no-inputs }}
97109 shell : bash
98110
99111 - name : Upload SARIF file to GitHub Advanced Security
You can’t perform that action at this time.
0 commit comments