Skip to content

Commit 18eb956

Browse files
MAINT: Add Zizmor (#327)
* Zizmor pre-commit config * Pin actions * run zizmor * Ignore codecov item * Add Zizmor github action
1 parent b7a71a4 commit 18eb956

File tree

4 files changed

+48
-11
lines changed

4 files changed

+48
-11
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ updates:
99
actions:
1010
patterns:
1111
- "*"
12+
cooldown:
13+
default-days: 7

.github/workflows/cd.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,22 @@ env:
1919
# one distinguishes color depth, where "3" -> "256-bit color".
2020
FORCE_COLOR: 3
2121

22+
permissions: {}
23+
2224
jobs:
2325
dist:
2426
name: Distribution build
2527
runs-on: ubuntu-latest
28+
permissions:
29+
contents: read
2630

2731
steps:
28-
- uses: actions/checkout@v6
32+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2933
with:
3034
fetch-depth: 0
35+
persist-credentials: false
3136

32-
- uses: hynek/build-and-inspect-python-package@v2
37+
- uses: hynek/build-and-inspect-python-package@fe0a0fb1925ca263d076ca4f2c13e93a6e92a33e # v2
3338

3439
publish:
3540
needs: [dist]
@@ -43,15 +48,15 @@ jobs:
4348
if: github.event_name == 'release' && github.event.action == 'published'
4449

4550
steps:
46-
- uses: actions/download-artifact@v7
51+
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
4752
with:
4853
name: Packages
4954
path: dist
5055

5156
- name: Generate artifact attestation for sdist and wheel
52-
uses: actions/attest-build-provenance@v3.2.0
57+
uses: actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2.0
5358
with:
5459
subject-path: "dist/*"
5560

5661
- name: Publish to PyPI
57-
uses: pypa/gh-action-pypi-publish@release/v1
62+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1

.github/workflows/ci.yml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,23 @@ env:
2020
# one distinguishes color depth, where "3" -> "256-bit color".
2121
FORCE_COLOR: 3
2222

23+
permissions: {}
24+
2325
jobs:
2426
cache-pixi-lock:
2527
runs-on: ubuntu-slim
28+
permissions:
29+
contents: read
2630
outputs:
2731
cache-key: ${{ steps.pixi-lock.outputs.cache-key }}
2832
pixi-version: ${{ steps.pixi-lock.outputs.pixi-version }}
2933
steps:
30-
- uses: actions/checkout@v4
34+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
35+
with:
36+
persist-credentials: false
3137
- uses: Parcels-code/pixi-lock/create-and-cache@38495788b79a5ff26009aecc15daa9a8310b8832 # v0.1.0
3238
id: pixi-lock
33-
- uses: actions/upload-artifact@v6 # make available as an artifact for local testing
39+
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
3440
with:
3541
name: pixi-lock
3642
path: pixi.lock
@@ -39,6 +45,8 @@ jobs:
3945
name: "Unit tests: ${{ matrix.runs-on }} | pixi run -e ${{ matrix.pixi-environment }} tests"
4046
runs-on: ${{ matrix.runs-on }}
4147
needs: cache-pixi-lock
48+
permissions:
49+
contents: read
4250
strategy:
4351
fail-fast: false
4452
matrix:
@@ -48,13 +56,14 @@ jobs:
4856
- pixi-environment: "test-py310"
4957
runs-on: ubuntu-latest
5058
steps:
51-
- uses: actions/checkout@v6
59+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
5260
with:
5361
fetch-depth: 0
62+
persist-credentials: false
5463
- uses: Parcels-code/pixi-lock/restore@38495788b79a5ff26009aecc15daa9a8310b8832 # v0.1.0
5564
with:
5665
cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }}
57-
- uses: prefix-dev/setup-pixi@v0.9.4
66+
- uses: prefix-dev/setup-pixi@a0af7a228712d6121d37aba47adf55c1332c9c2e # v0.9.4
5867
with:
5968
cache: true
6069
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
@@ -66,9 +75,25 @@ jobs:
6675
--durations=20
6776

6877
- name: Upload coverage report
69-
uses: codecov/codecov-action@v5.5.2
78+
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
79+
with:
80+
token: ${{ secrets.CODECOV_TOKEN }} # zizmor: ignore[secrets-outside-env]
81+
82+
zizmor:
83+
name: GHA Security Analysis using Zizmor
84+
runs-on: ubuntu-latest
85+
permissions:
86+
security-events: write # Required for upload-sarif (used by zizmor-action) to upload SARIF files.
87+
steps:
88+
- name: Checkout repository
89+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
7090
with:
71-
token: ${{ secrets.CODECOV_TOKEN }}
91+
persist-credentials: false
92+
93+
- name: Run zizmor
94+
uses: zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # v0.5.2
95+
96+
7297
# typechecking:
7398
# name: "TypeChecking: pixi run typing"
7499
# runs-on: ubuntu-latest

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ repos:
1010
- id: check-json
1111
types: [text]
1212
files: \.(json|ipynb)$
13+
- repo: https://github.com/zizmorcore/zizmor-pre-commit
14+
rev: v1.23.1
15+
hooks:
16+
- id: zizmor
17+
args: ["--offline"]
1318
- repo: https://github.com/astral-sh/ruff-pre-commit
1419
rev: v0.15.9
1520
hooks:

0 commit comments

Comments
 (0)