Skip to content

Commit 1bb2924

Browse files
fix: unset GH_TOKEN when empty in run-script workflow (#4)
### what Unset the GH_TOKEN var if empty (the token is not passed in) ### why zizmor thinks the token is there if the var is set, but empty, so it fails ### testing will test once merged ### docs n/a
1 parent f9c9366 commit 1bb2924

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎.github/workflows/run-script.yml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ jobs:
5959
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
6060

6161
- name: Run
62-
run: ${{ inputs.run }} # zizmor: ignore[template-injection] caller-provided script
62+
# Some tools reject an empty GH_TOKEN (e.g. zizmor), so unset it rather
63+
# than leaving it empty.
64+
run: | # zizmor: ignore[template-injection] caller-provided script
65+
[ -n "$GH_TOKEN" ] || unset GH_TOKEN
66+
${{ inputs.run }}
6367
env:
6468
GH_TOKEN: ${{ inputs.github-token && github.token || '' }}
6569
# Point prek at the pre-commit cache path so the cache step covers both.

0 commit comments

Comments
 (0)