Skip to content

Commit 0db637a

Browse files
Merge pull request #5 from crazy-max/octoguard-repo-uses
octoguard: move zizmor job within octoguard one
2 parents c054534 + 4a968aa commit 0db637a

File tree

2 files changed

+65
-87
lines changed

2 files changed

+65
-87
lines changed

Diff for: .github/workflows/octoguard.yml

+65-3
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,74 @@ permissions:
1212
contents: read
1313
actions: read
1414

15+
env:
16+
ZIZMOR_VERSION: 1.5.2
17+
1518
jobs:
1619
zizmor:
17-
uses: ./.github/workflows/zizmor.yml
20+
runs-on: ubuntu-24.04
1821
permissions:
1922
contents: read
2023
actions: read
2124
security-events: write
22-
with:
23-
zizmor_version: 1.5.2
25+
steps:
26+
-
27+
name: Checkout
28+
uses: actions/checkout@v4 # zizmor: ignore[artipacked] fine to ignore official actions
29+
with:
30+
persist-credentials: false
31+
-
32+
name: Checks
33+
uses: actions/github-script@v7 # zizmor: ignore[artipacked] fine to ignore official actions
34+
with:
35+
script: |
36+
const fs = require('fs');
37+
38+
const workflows = fs.readdirSync('.github/workflows').filter(file => file.endsWith('.yml') || file.endsWith('.yaml'));
39+
if (workflows.length > 0) {
40+
core.info(`${workflows.length} workflows found in this repository.`);
41+
core.exportVariable('HAS_WORKFLOWS', 'true');
42+
} else {
43+
core.warning("No workflows found, skipping zizmor scan.");
44+
return;
45+
}
46+
47+
try {
48+
await github.request('GET /repos/{owner}/{repo}/code-scanning/alerts', {
49+
...context.repo,
50+
}).catch(err => {
51+
if (err.status === 403) {
52+
throw new Error('Advanced Security needs to be enabled on this repository.');
53+
}
54+
});
55+
core.info('Advanced Security is enabled on this repository.');
56+
} catch (err) {
57+
core.setFailed(err.message);
58+
}
59+
-
60+
name: Setup uv
61+
if: ${{ env.HAS_WORKFLOWS }}
62+
uses: astral-sh/setup-uv@0c5e2b8115b80b4c7c5ddf6ffdd634974642d182 # v5.4.1
63+
with:
64+
enable-cache: false
65+
-
66+
name: Install zizmor
67+
if: ${{ env.HAS_WORKFLOWS }}
68+
run: |
69+
set -ex
70+
uv tool install zizmor@${ZIZMOR_VERSION}
71+
-
72+
name: Run zizmor
73+
if: ${{ env.HAS_WORKFLOWS }}
74+
env:
75+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
run: |
77+
set -ex
78+
zizmor --min-severity=medium --min-confidence=medium --persona=pedantic --no-online-audits --format=sarif . > /tmp/zizmor.sarif
79+
-
80+
name: Upload SARIF report
81+
if: ${{ env.HAS_WORKFLOWS }}
82+
uses: github/codeql-action/upload-sarif@v3 # zizmor: ignore[artipacked] fine to ignore official actions
83+
with:
84+
sarif_file: /tmp/zizmor.sarif
85+
category: zizmor

Diff for: .github/workflows/zizmor.yml

-84
This file was deleted.

0 commit comments

Comments
 (0)