Skip to content

octoguard: move zizmor job within octoguard one #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 65 additions & 3 deletions .github/workflows/octoguard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,74 @@ permissions:
contents: read
actions: read

env:
ZIZMOR_VERSION: 1.5.2

jobs:
zizmor:
uses: ./.github/workflows/zizmor.yml
runs-on: ubuntu-24.04
permissions:
contents: read
actions: read
security-events: write
with:
zizmor_version: 1.5.2
steps:
-
name: Checkout
uses: actions/checkout@v4 # zizmor: ignore[artipacked] fine to ignore official actions
with:
persist-credentials: false
-
name: Checks
uses: actions/github-script@v7 # zizmor: ignore[artipacked] fine to ignore official actions
with:
script: |
const fs = require('fs');

const workflows = fs.readdirSync('.github/workflows').filter(file => file.endsWith('.yml') || file.endsWith('.yaml'));
if (workflows.length > 0) {
core.info(`${workflows.length} workflows found in this repository.`);
core.exportVariable('HAS_WORKFLOWS', 'true');
} else {
core.warning("No workflows found, skipping zizmor scan.");
return;
}

try {
await github.request('GET /repos/{owner}/{repo}/code-scanning/alerts', {
...context.repo,
}).catch(err => {
if (err.status === 403) {
throw new Error('Advanced Security needs to be enabled on this repository.');
}
});
core.info('Advanced Security is enabled on this repository.');
} catch (err) {
core.setFailed(err.message);
}
-
name: Setup uv
if: ${{ env.HAS_WORKFLOWS }}
uses: astral-sh/setup-uv@0c5e2b8115b80b4c7c5ddf6ffdd634974642d182 # v5.4.1
with:
enable-cache: false
-
name: Install zizmor
if: ${{ env.HAS_WORKFLOWS }}
run: |
set -ex
uv tool install zizmor@${ZIZMOR_VERSION}
-
name: Run zizmor
if: ${{ env.HAS_WORKFLOWS }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -ex
zizmor --min-severity=medium --min-confidence=medium --persona=pedantic --no-online-audits --format=sarif . > /tmp/zizmor.sarif
-
name: Upload SARIF report
if: ${{ env.HAS_WORKFLOWS }}
uses: github/codeql-action/upload-sarif@v3 # zizmor: ignore[artipacked] fine to ignore official actions
with:
sarif_file: /tmp/zizmor.sarif
category: zizmor
84 changes: 0 additions & 84 deletions .github/workflows/zizmor.yml

This file was deleted.