Skip to content

Commit 915966b

Browse files
conditional run of zizmor (#31)
* conditional run of zizmor * change search parameter
1 parent cbb0636 commit 915966b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.github/workflows/self-zizmor.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,26 @@ on:
77
paths:
88
- ".github/**"
99
jobs:
10+
zizmor-check:
11+
name: Check whether there are things to scan
12+
permissions:
13+
contents: read
14+
runs-on: ${{ !github.event.repository.private && 'ubuntu-latest' || 'ubuntu-arm64-small' }}
15+
outputs:
16+
found-files: ${{ steps.zizmor-check.outputs.found-files }}
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
20+
- name: Run zizmor
21+
id: zizmor-check
22+
shell: bash
23+
run: |
24+
FOUND_FILES=false
25+
SEARCH=$(find . -path "**/.github/workflows/*.yml" -o -path "**/.github/workflows/*.yaml" -o -path "**/action.yml" -o -path "**/action.yaml")
26+
if [ -n "$SEARCH" ]; then
27+
FOUND_FILES=true
28+
fi
29+
echo "found-files=${FOUND_FILES}" >> $GITHUB_OUTPUT
1030
zizmor:
1131
name: Run zizmor from current branch (self test)
1232

@@ -17,6 +37,10 @@ jobs:
1737
pull-requests: write
1838
security-events: write
1939

40+
needs:
41+
- zizmor-check
42+
if: ${{ needs.zizmor-check.outputs.found-files == 'true' }}
43+
2044
uses: grafana/shared-workflows/.github/workflows/reusable-zizmor.yml@b502a15952bab7f72daa1f8ce115491a6d97be59
2145
with:
2246
runs-on: ${{ !github.event.repository.private && 'ubuntu-latest' || 'ubuntu-arm64-small' }}

0 commit comments

Comments
 (0)