Skip to content

Commit 3e1ea28

Browse files
bkochendorferjbuck
andauthored
feat(zizmor): Add Zizmor GitHub Action (#280)
* feat(zizmor): Add Zizmor GitHub Action Zizmor is a Static Analysis tool for GitHub Actions https://woodruffw.github.io/zizmor/usage/#use-in-github-actions * Update .github/workflows/zizmor.yaml Co-authored-by: Jon Buckley <[email protected]> --------- Co-authored-by: Jon Buckley <[email protected]>
1 parent 6d2e1e5 commit 3e1ea28

File tree

5 files changed

+47
-3
lines changed

5 files changed

+47
-3
lines changed

.github/actions/action.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,11 @@ runs:
7474
shell: bash
7575
run: |
7676
mkdir output
77-
echo '${{ steps.prev-version.outputs.result }}' > output/previous-version.txt
78-
echo '${{ steps.new-version.outputs.result }}' > output/new-version.txt
77+
echo '${PREV_VERSION}' > output/previous-version.txt
78+
echo '${NEW_VERSION}' > output/new-version.txt
79+
env:
80+
PREV_VERSION: "${{ steps.prev-version.outputs.result }}"
81+
NEW_VERSIION: "${{ steps.new-version.outputs.result }}"
7982
- name: Upload version artifacts
8083
uses: actions/upload-artifact@v4
8184
with:

.github/workflows/ci.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
- push
55
- pull_request
66

7+
permissions: {}
8+
79
jobs:
810
matrixify:
911
name: Matrixify
@@ -18,7 +20,9 @@ jobs:
1820
with:
1921
ignore_dir: "**/example**"
2022
- name: Outputs
21-
run: echo "${{ steps.search.outputs.matrix }}"
23+
run: echo "${OUTPUTS_MATRIX}"
24+
env:
25+
OUTPUTS_MATRIX: ${{ steps.search.outputs.matrix }}
2226

2327
terraform-ci:
2428
name: Terraform CI on "${{ matrix.directory }}"

.github/workflows/monorepo.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
ref: ${{ github.event.pull_request.head.ref }}
3232
# I'm getting the labels from the API and not the context("contains(github.event.pull_request.labels.*.name, 'Env Promote')") as the labels
3333
# are added in 2nd API call so they aren't included in the PR context
34+
persist-credentials: false
3435
- name: Check PR labels for semver
3536
id: check_pr_label
3637
env:
@@ -147,6 +148,7 @@ jobs:
147148
uses: actions/checkout@v4
148149
with:
149150
ref: main # Only use composite action from main to prevent malicious PRs
151+
persist-credentials: false
150152
# Do the per-module steps in a composite action because matrixes can't handle dynamic outputs
151153
- name: Generate docs and version bump
152154
uses: mozilla/terraform-modules/.github/actions@main

.github/workflows/zizmor.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# https://github.com/woodruffw/zizmor
2+
name: GitHub Actions Security Analysis with Zizmor
3+
4+
on:
5+
push:
6+
branches: ["main"]
7+
pull_request:
8+
branches: ["*"]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
12+
cancel-in-progress: true
13+
14+
permissions: {}
15+
16+
jobs:
17+
zizmor:
18+
name: Zizmor latest via Cargo
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Clone Repository
22+
uses: actions/checkout@v4
23+
with:
24+
persist-credentials: false
25+
26+
- run: python -m pip install zizmor
27+
shell: bash
28+
- name: Run zizmor
29+
run: zizmor .

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,9 @@ repos:
2222
- id: terraform_fmt
2323
exclude: \.terraform\/.*$
2424
- id: terraform_docs
25+
- repo: https://github.com/woodruffw/zizmor-pre-commit
26+
# Zizmor version.
27+
rev: v1.5.2
28+
hooks:
29+
# Run the linter.
30+
- id: zizmor

0 commit comments

Comments
 (0)