Skip to content

Commit f8bce52

Browse files
Merge pull request #102 from graingert/zizmor
Add zizmor pre-commit hook for GitHub Actions security
2 parents a28e473 + d2275de commit f8bce52

File tree

4 files changed

+32
-12
lines changed

4 files changed

+32
-12
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ updates:
1111
- "*" # Group all Actions updates into a single larger pull request
1212
schedule:
1313
interval: weekly
14+
cooldown:
15+
default-days: 7

.github/workflows/deploy.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,20 @@ on:
88
required: true
99
default: '1.2.3'
1010

11+
permissions: {}
12+
1113
jobs:
1214

1315
package:
1416
runs-on: ubuntu-latest
1517

1618
steps:
17-
- uses: actions/checkout@v6
19+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
20+
with:
21+
persist-credentials: false
1822

1923
- name: Build and Check Package
20-
uses: hynek/build-and-inspect-python-package@v2.17
24+
uses: hynek/build-and-inspect-python-package@fe0a0fb1925ca263d076ca4f2c13e93a6e92a33e # v2.17
2125

2226
deploy:
2327
needs: package
@@ -27,22 +31,25 @@ jobs:
2731
contents: write # For tag.
2832

2933
steps:
30-
- uses: actions/checkout@v6
34+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
35+
with:
36+
persist-credentials: false
3137

3238
- name: Download Package
33-
uses: actions/download-artifact@v8
39+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
3440
with:
3541
name: Packages
3642
path: dist
3743

3844
- name: Publish package to PyPI
39-
uses: pypa/gh-action-pypi-publish@v1.13.0
45+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
4046
with:
4147
attestations: true
4248

4349
- name: GitHub Release
4450
env:
4551
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
GITHUB_EVENT_INPUTS_VERSION: ${{ github.event.inputs.version }}
4653
run: |
47-
gh release create v${{ github.event.inputs.version }} --target=${{ github.ref_name }} --title v${{ github.event.inputs.version }}
48-
gh pr merge ${{ github.ref_name }} --merge
54+
gh release create v${GITHUB_EVENT_INPUTS_VERSION} --target=${GITHUB_REF_NAME} --title v${GITHUB_EVENT_INPUTS_VERSION}
55+
gh pr merge ${GITHUB_REF_NAME} --merge

.github/workflows/test.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ on:
1010
branches:
1111
- "*"
1212

13+
permissions: {}
14+
1315
env:
1416
FORCE_COLOR: 1
1517

@@ -22,9 +24,11 @@ jobs:
2224
package:
2325
runs-on: ubuntu-latest
2426
steps:
25-
- uses: actions/checkout@v6
27+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
28+
with:
29+
persist-credentials: false
2630
- name: Build and Check Package
27-
uses: hynek/build-and-inspect-python-package@v2.17
31+
uses: hynek/build-and-inspect-python-package@fe0a0fb1925ca263d076ca4f2c13e93a6e92a33e # v2.17
2832

2933
test:
3034
needs: [package]
@@ -36,16 +40,18 @@ jobs:
3640
os: [ubuntu-latest, macos-latest] # , windows-latest] # Windows tests will fail.
3741

3842
steps:
39-
- uses: actions/checkout@v6
43+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
44+
with:
45+
persist-credentials: false
4046

4147
- name: Download Package
42-
uses: actions/download-artifact@v8
48+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
4349
with:
4450
name: Packages
4551
path: dist
4652

4753
- name: Set up Python ${{ matrix.python-version }}
48-
uses: actions/setup-python@v6
54+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
4955
with:
5056
python-version: ${{ matrix.python-version }}
5157
allow-prereleases: true

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ repos:
55
- id: ruff-check
66
args: [--fix]
77
- id: ruff-format
8+
- repo: https://github.com/woodruffw/zizmor-pre-commit
9+
rev: v1.23.1
10+
hooks:
11+
- id: zizmor
12+
args: ["--fix", "--no-progress"]
813
- repo: https://github.com/pre-commit/pre-commit-hooks
914
rev: v6.0.0
1015
hooks:

0 commit comments

Comments
 (0)