Skip to content

Commit e969335

Browse files
conditional run of zizmor
1 parent cbb0636 commit e969335

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

.github/workflows/self-zizmor.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,31 @@ 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+
if [ -e .github/workflows/*.{yml,yaml} ]; then
26+
FOUND_FILES=true
27+
fi
28+
if [ -e **/.github/workflows/*.{yml,yaml} ]; then
29+
FOUND_FILES=true
30+
fi
31+
if [ -e **/action.{yml,yaml} ]; then
32+
FOUND_FILES=true
33+
fi
34+
echo "found-files=${FOUND_FILES}" >> $GITHUB_OUTPUT
1035
zizmor:
1136
name: Run zizmor from current branch (self test)
1237

@@ -17,6 +42,10 @@ jobs:
1742
pull-requests: write
1843
security-events: write
1944

45+
needs:
46+
- zizmor-check
47+
if: ${{ needs.zizmor-check.outputs.found-files == 'true' }}
48+
2049
uses: grafana/shared-workflows/.github/workflows/reusable-zizmor.yml@b502a15952bab7f72daa1f8ce115491a6d97be59
2150
with:
2251
runs-on: ${{ !github.event.repository.private && 'ubuntu-latest' || 'ubuntu-arm64-small' }}

0 commit comments

Comments
 (0)