Skip to content

Commit b0ba259

Browse files
authored
Merge branch 'main' into perf/skip-non-interactive-live-updates
2 parents a73311c + 24573bb commit b0ba259

File tree

7 files changed

+108
-36
lines changed

7 files changed

+108
-36
lines changed

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ updates:
55
directory: "/"
66
schedule:
77
interval: "weekly"
8+
cooldown:
9+
default-days: 7
810
groups:
911
github-actions:
1012
patterns:
@@ -13,3 +15,5 @@ updates:
1315
directory: "/"
1416
schedule:
1517
interval: "weekly"
18+
cooldown:
19+
default-days: 7

.github/workflows/main.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,26 @@ on:
1414
- '*'
1515
merge_group:
1616

17+
permissions: {}
18+
1719
jobs:
1820

1921
run-type-checking:
2022

2123
name: Run tests for type-checking
2224
runs-on: ubuntu-latest
25+
permissions:
26+
contents: read
2327

2428
steps:
25-
- uses: actions/checkout@v6
26-
- uses: astral-sh/setup-uv@v7
29+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
30+
with:
31+
persist-credentials: false
32+
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
2733
with:
2834
enable-cache: true
2935
- name: Install just
30-
uses: extractions/setup-just@v3
36+
uses: extractions/setup-just@f8a3cce218d9f83db3a2ecd90e41ac3de6cdfd9b # v3
3137
- name: Install graphviz
3238
run: |
3339
sudo apt-get update
@@ -38,6 +44,8 @@ jobs:
3844

3945
name: Run tests for ${{ matrix.os }} on ${{ matrix.python-version }}
4046
runs-on: ${{ matrix.os }}
47+
permissions:
48+
contents: read
4149

4250
strategy:
4351
fail-fast: false
@@ -46,13 +54,15 @@ jobs:
4654
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
4755

4856
steps:
49-
- uses: actions/checkout@v6
50-
- uses: astral-sh/setup-uv@v7
57+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
58+
with:
59+
persist-credentials: false
60+
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
5161
with:
5262
enable-cache: true
5363
python-version: ${{ matrix.python-version }}
5464
- name: Install just
55-
uses: extractions/setup-just@v3
65+
uses: extractions/setup-just@f8a3cce218d9f83db3a2ecd90e41ac3de6cdfd9b # v3
5666

5767
- if: matrix.os == 'ubuntu-latest'
5868
run: |
@@ -71,7 +81,7 @@ jobs:
7181
run: uv run --group test pytest --cov=src --cov=tests --cov-report=xml -n auto
7282

7383
- name: Upload test coverage reports to Codecov with GitHub Action
74-
uses: codecov/codecov-action@v5
84+
uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5
7585

7686
- name: Run tests with lowest resolution
7787
if: matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest'

.github/workflows/publish-to-pypi.yml

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,28 @@ name: Publish Python 🐍 distribution 📦 to PyPI
22

33
on: push
44

5+
permissions: {}
6+
57
jobs:
68
build:
79
name: Build distribution 📦
810
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
913

1014
steps:
11-
- uses: actions/checkout@v6
12-
- name: Set up Python
13-
uses: actions/setup-python@v6
15+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1416
with:
15-
python-version: "3.x"
16-
- name: Install pypa/build
17-
run: >-
18-
python3 -m
19-
pip install
20-
build
21-
--user
17+
persist-credentials: false
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
20+
with:
21+
enable-cache: true
22+
python-version: "3.13"
2223
- name: Build a binary wheel and a source tarball
23-
run: python3 -m build
24+
run: uv build
2425
- name: Store the distribution packages
25-
uses: actions/upload-artifact@v7
26+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
2627
with:
2728
name: python-package-distributions
2829
path: dist/
@@ -41,12 +42,14 @@ jobs:
4142

4243
steps:
4344
- name: Download all the dists
44-
uses: actions/download-artifact@v8
45+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
4546
with:
4647
name: python-package-distributions
4748
path: dist/
49+
- name: Install uv
50+
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
4851
- name: Publish distribution 📦 to PyPI
49-
uses: pypa/gh-action-pypi-publish@release/v1
52+
run: uv publish
5053

5154
github-release:
5255
name: >-
@@ -62,30 +65,34 @@ jobs:
6265

6366
steps:
6467
- name: Download all the dists
65-
uses: actions/download-artifact@v8
68+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
6669
with:
6770
name: python-package-distributions
6871
path: dist/
6972
- name: Sign the dists with Sigstore
70-
uses: sigstore/gh-action-sigstore-python@v3.2.0
73+
uses: sigstore/gh-action-sigstore-python@a5caf349bc536fbef3668a10ed7f5cd309a4b53d # v3.2.0
7174
with:
7275
inputs: >-
7376
./dist/*.tar.gz
7477
./dist/*.whl
7578
- name: Create GitHub Release
7679
env:
7780
GITHUB_TOKEN: ${{ github.token }}
81+
RELEASE_TAG: ${{ github.ref_name }}
82+
REPOSITORY: ${{ github.repository }}
7883
run: >-
7984
gh release create
80-
'${{ github.ref_name }}'
81-
--repo '${{ github.repository }}'
85+
"$RELEASE_TAG"
86+
--repo "$REPOSITORY"
8287
--notes ""
8388
- name: Upload artifact signatures to GitHub Release
8489
env:
8590
GITHUB_TOKEN: ${{ github.token }}
91+
RELEASE_TAG: ${{ github.ref_name }}
92+
REPOSITORY: ${{ github.repository }}
8693
# Upload to GitHub Release using the `gh` CLI. `dist/` contains the built
8794
# packages, and the sigstore-produced signatures and certificates.
8895
run: >-
8996
gh release upload
90-
'${{ github.ref_name }}' dist/**
91-
--repo '${{ github.repository }}'
97+
"$RELEASE_TAG" dist/**
98+
--repo "$REPOSITORY"

.github/workflows/update-plugin-list.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,18 @@ jobs:
1919

2020
steps:
2121
- name: Checkout
22-
uses: actions/checkout@v6
22+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2323
with:
2424
fetch-depth: 0
25+
persist-credentials: false
2526

26-
- name: Setup Python
27-
uses: actions/setup-python@v6
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
2829
with:
2930
python-version: 3.12
3031

31-
- name: Install dependencies
32-
run: |
33-
python -m pip install --upgrade pip
34-
pip install packaging httpx tabulate[widechars] tqdm
35-
3632
- name: Update Plugin List
37-
run: python scripts/update_plugin_list.py
33+
run: uv run --group plugin-list python scripts/update_plugin_list.py
3834

3935
- name: Create Pull Request
4036
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0

.github/workflows/zizmor.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: zizmor
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- '*'
10+
schedule:
11+
- cron: '0 7 * * 1'
12+
workflow_dispatch:
13+
14+
permissions: {}
15+
16+
jobs:
17+
zizmor:
18+
name: Scan GitHub Actions
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
security-events: write
23+
24+
steps:
25+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
26+
with:
27+
persist-credentials: false
28+
29+
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
30+
with:
31+
enable-cache: true
32+
python-version: '3.13'
33+
34+
- name: Run zizmor
35+
run: uvx --from zizmor zizmor --format=github .
36+
37+
- name: Generate SARIF report
38+
if: always()
39+
run: uvx --from zizmor zizmor --format=sarif --no-exit-codes . > zizmor.sarif
40+
41+
- name: Upload SARIF report
42+
if: >
43+
always() &&
44+
(github.event_name != 'pull_request' ||
45+
github.event.pull_request.head.repo.full_name == github.repository)
46+
uses: github/codeql-action/upload-sarif@c10b8064de6f491fea524254123dbe5e09572f13 # v4
47+
with:
48+
sarif_file: zizmor.sarif

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and
1010
- [#837](https://github.com/pytask-dev/pytask/pull/837) skips incremental live
1111
rendering on non-interactive output while preserving the final build table and
1212
live-manager lifecycle.
13+
- [#836](https://github.com/pytask-dev/pytask/pull/836) hardens GitHub Actions
14+
workflows with zizmor, pinned action SHAs, explicit permissions, and a dedicated
15+
code-scanning upload workflow.
1316
- [#830](https://github.com/pytask-dev/pytask/pull/830) replaces the internal
1417
`networkx` dependency with a pytask-owned DAG implementation, lazy-loads
1518
`networkx` only for DAG export and visualization, and makes the `networkx`

justfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ typing:
1818
lint:
1919
uvx prek run -a
2020

21+
# Run static analysis for GitHub Actions
22+
zizmor:
23+
uvx --from zizmor zizmor .
24+
2125
# Run all checks (format, lint, typing, test)
2226
check: lint typing test
2327

0 commit comments

Comments
 (0)