Skip to content

Commit e512bf2

Browse files
committed
actions: Start linting with zizmor
Both actions and workflows get checked at the same time. * Add lint workflow: this did not quite fit in the normal test matrix since it needs GH_TOKEN (and because the dependencies are tracked separately) so I added a separate workflow * "tox -e lint-actions" works too (and this is included in "tox -m lint") although these miss a few checks because github token is not available * A few workflow issues found by zizmor are fixed as well
1 parent d48c4d1 commit e512bf2

File tree

6 files changed

+51
-0
lines changed

6 files changed

+51
-0
lines changed

.github/workflows/actions-lint.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Lint actions & workflows
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
permissions: {}
10+
11+
jobs:
12+
lint-actions-and-workflows:
13+
permissions:
14+
security-events: write
15+
contents: read
16+
actions: read
17+
runs-on: ubuntu-latest
18+
env:
19+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
21+
steps:
22+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23+
with:
24+
persist-credentials: false
25+
26+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
27+
with:
28+
python-version: '3.13'
29+
cache: 'pip'
30+
cache-dependency-path: |
31+
actions/lint-requirements.txt
32+
33+
- name: Install zizmor
34+
run: python -m pip install -r actions/lint-requirements.txt
35+
36+
- name: Run zizmor
37+
run: zizmor --pedantic .

.github/workflows/ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ jobs:
3434

3535
steps:
3636
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
37+
with:
38+
persist-credentials: false
3739

3840
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
3941
with:

.github/workflows/release.yml

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
17+
with:
18+
persist-credentials: false
1719

1820
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
1921
with:

.github/workflows/update-pinned-deps.yml

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919

2020
steps:
2121
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22+
with:
23+
persist-credentials: false
2224

2325
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
2426
with:

actions/lint-requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
zizmor == 1.3.1

tox.ini

+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ commands =
2323
ruff format --check --diff .
2424
mypy .
2525

26+
[testenv:lint-actions]
27+
description = Actions Linting
28+
labels = lint
29+
deps = -r actions/lint-requirements.txt
30+
commands =
31+
zizmor --pedantic .
32+
2633
[testenv:test-repo]
2734
description = Repository unit tests
2835
labels = test

0 commit comments

Comments
 (0)