Skip to content

Commit 5793b5c

Browse files
fix: only use zizmor config if it exists (#979)
* fix: only use zizmor config if it exists * implement suggestions * implement suggestions * address comments
1 parent 06dde69 commit 5793b5c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

.github/workflows/reusable-zizmor.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ jobs:
240240
ZIZMOR_VERSION: 1.6.0
241241
GH_TOKEN: ${{ inputs.github-token || github.token }}
242242
ZIZMOR_EXTRA_ARGS: ${{ inputs.extra-args }}
243+
DEFAULT_ZIZMOR_CONFIG_DOWNLOADED: ${{ needs.job-workflow-ref.outputs.sha }}
243244

244245
steps:
245246
- name: Harden the runner (Audit all outbound calls)
@@ -256,13 +257,14 @@ jobs:
256257
- name: Restore config from cache
257258
id: cache-config
258259
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
260+
if: env.DEFAULT_ZIZMOR_CONFIG_DOWNLOADED
259261
with:
260262
path: ${{ runner.temp }}/zizmor.yml
261263
key: zizmor-config-${{ needs.job-workflow-ref.outputs.repo }}-${{ needs.job-workflow-ref.outputs.sha }}
262264

263265
- name: Fetch Zizmor Config
264266
id: fetch-config
265-
if: steps.cache-config.outputs.cache-hit != 'true'
267+
if: steps.cache-config.outputs.cache-hit != 'true' && env.DEFAULT_ZIZMOR_CONFIG_DOWNLOADED
266268
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
267269
env:
268270
OWNER: ${{ needs.job-workflow-ref.outputs.owner }}
@@ -349,7 +351,9 @@ jobs:
349351
fi
350352
351353
ZIZMOR_CONFIG="${{ runner.temp }}/zizmor.yml"
352-
echo "zizmor-config=${ZIZMOR_CONFIG}" | tee -a "${GITHUB_OUTPUT}"
354+
if [ -n "${DEFAULT_ZIZMOR_CONFIG_DOWNLOADED}" ]; then
355+
echo "zizmor-config=${ZIZMOR_CONFIG}" | tee -a "${GITHUB_OUTPUT}"
356+
fi
353357
354358
- name: Setup UV
355359
uses: astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1

0 commit comments

Comments
 (0)