Skip to content
Closed
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
33 changes: 31 additions & 2 deletions .github/workflows/audit-gha-workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,35 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ -d .github ]; then
zizmor .github --gh-token "${GITHUB_TOKEN}" --min-severity medium
if [ ! -d .github ]; then
exit 0
fi
if [[ "$GITHUB_REPOSITORY" != SocketDev/depscan || ! -f .github/zizmor-patches.yml ]]; then
zizmor .github --gh-token "$GITHUB_TOKEN" --min-severity medium
exit 0
fi

audit_dir=$(mktemp -d)
trap 'rm -rf "$audit_dir"' EXIT
cp -R .github "$audit_dir/.github"
for config in zizmor.yml zizmor.yaml; do
if [ -f "$config" ]; then
cp "$config" "$audit_dir/$config"
fi
done
patch_workflows=()
for workflow in deploy-patches-staging.yaml deploy-patches-prod.yaml patches-compatibility.yaml; do
workflow=".github/workflows/$workflow"
if [ -f "$workflow" ]; then
patch_workflows+=("$workflow")
rm "$audit_dir/$workflow"
fi
done

status=0
zizmor "$audit_dir/.github" --gh-token "$GITHUB_TOKEN" --min-severity medium || status=$?
if [ "${#patch_workflows[@]}" -gt 0 ]; then
zizmor "${patch_workflows[@]}" --config .github/zizmor-patches.yml \
--gh-token "$GITHUB_TOKEN" --min-severity medium || status=$?
fi
exit "$status"