Skip to content

Commit 79201d2

Browse files
authored
fix(ci): resolve all zizmor findings and add zizmor pre-commit checks (#256)
Similar to upstream changes in `shared-workflows`, this PR cleans up and annotates all of the workflows and adds the `zizmor` linter to make sure changes are checked. Part of rapidsai/build-planning#275 Authors: - Gil Forsyth (https://github.com/gforsyth) Approvers: - https://github.com/jakirkham URL: #256
1 parent 5a7e1de commit 79201d2

5 files changed

Lines changed: 97 additions & 20 deletions

File tree

.github/workflows/build.yaml

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: build
2-
32
on:
43
push:
54
branches:
@@ -27,14 +26,13 @@ on:
2726
description: "build_type: one of [branch, nightly, pull-request]"
2827
type: string
2928
default: nightly
30-
3129
concurrency:
3230
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
3331
cancel-in-progress: true
34-
32+
permissions: {}
3533
jobs:
3634
conda-python-build:
37-
secrets: inherit
35+
secrets: inherit # zizmor: ignore[secrets-inherit]
3836
uses: rapidsai/shared-workflows/.github/workflows/conda-python-build.yaml@branch-25.10
3937
with:
4038
build_type: ${{ inputs.build_type || 'branch' }}
@@ -44,17 +42,29 @@ jobs:
4442
sha: ${{ inputs.sha }}
4543
# Package is pure Python and only ever requires one build.
4644
matrix_filter: 'map(select(.ARCH == "amd64" and (.LINUX_VER | test("centos")|not))) | sort_by(.PY_VER | split(".") | map(tonumber)) | [.[-1]]'
45+
permissions:
46+
actions: read
47+
contents: read
48+
id-token: write
49+
packages: read
50+
pull-requests: read
4751
upload-conda:
4852
needs: conda-python-build
49-
secrets: inherit
53+
secrets: inherit # zizmor: ignore[secrets-inherit]
5054
uses: rapidsai/shared-workflows/.github/workflows/conda-upload-packages.yaml@branch-25.10
5155
with:
5256
build_type: ${{ inputs.build_type || 'branch' }}
5357
branch: ${{ inputs.branch }}
5458
date: ${{ inputs.date }}
5559
sha: ${{ inputs.sha }}
60+
permissions:
61+
actions: read
62+
contents: read
63+
id-token: write
64+
packages: read
65+
pull-requests: read
5666
wheel-build:
57-
secrets: inherit
67+
secrets: inherit # zizmor: ignore[secrets-inherit]
5868
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-25.10
5969
with:
6070
build_type: ${{ inputs.build_type || 'branch' }}
@@ -68,9 +78,15 @@ jobs:
6878
package-type: python
6979
pure-wheel: true
7080
append-cuda-suffix: false
81+
permissions:
82+
actions: read
83+
contents: read
84+
id-token: write
85+
packages: read
86+
pull-requests: read
7187
wheel-publish:
7288
needs: wheel-build
73-
secrets: inherit
89+
secrets: inherit # zizmor: ignore[secrets-inherit]
7490
uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@branch-25.10
7591
with:
7692
build_type: ${{ inputs.build_type || 'branch' }}
@@ -79,3 +95,9 @@ jobs:
7995
date: ${{ inputs.date }}
8096
package-name: jupyterlab-nvdashboard
8197
publish_to_pypi: true
98+
permissions:
99+
actions: read
100+
contents: read
101+
id-token: write
102+
packages: read
103+
pull-requests: read

.github/workflows/pr.yaml

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
name: pr
2-
32
on:
43
push:
54
branches:
65
- "pull-request/[0-9]+"
7-
86
concurrency:
97
group: ${{ github.workflow }}-${{ github.ref }}
108
cancel-in-progress: true
11-
9+
permissions: {}
1210
jobs:
1311
pr-builder:
1412
needs:
@@ -17,32 +15,56 @@ jobs:
1715
- conda-python-tests
1816
- wheel-build
1917
- wheel-tests
20-
secrets: inherit
18+
secrets: inherit # zizmor: ignore[secrets-inherit]
2119
uses: rapidsai/shared-workflows/.github/workflows/pr-builder.yaml@branch-25.10
20+
permissions:
21+
actions: read
22+
contents: read
23+
id-token: write
24+
packages: read
25+
pull-requests: read
2226
checks:
23-
secrets: inherit
27+
secrets: inherit # zizmor: ignore[secrets-inherit]
2428
uses: rapidsai/shared-workflows/.github/workflows/checks.yaml@branch-25.10
29+
permissions:
30+
actions: read
31+
contents: read
32+
id-token: write
33+
packages: read
34+
pull-requests: read
2535
conda-python-build:
2636
needs: checks
27-
secrets: inherit
37+
secrets: inherit # zizmor: ignore[secrets-inherit]
2838
uses: rapidsai/shared-workflows/.github/workflows/conda-python-build.yaml@branch-25.10
2939
with:
3040
build_type: pull-request
3141
# This selects "ARCH=amd64 + the latest supported Python + CUDA".
3242
matrix_filter: map(select(.ARCH == "amd64")) | max_by([(.PY_VER|split(".")|map(tonumber)), (.CUDA_VER|split(".")|map(tonumber))]) | [.]
3343
script: ci/build_python.sh
44+
permissions:
45+
actions: read
46+
contents: read
47+
id-token: write
48+
packages: read
49+
pull-requests: read
3450
conda-python-tests:
3551
needs: conda-python-build
36-
secrets: inherit
52+
secrets: inherit # zizmor: ignore[secrets-inherit]
3753
uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@branch-25.10
3854
with:
3955
build_type: pull-request
4056
# This selects "ARCH=amd64 + the latest supported Python".
4157
matrix_filter: map(select(.ARCH == "amd64")) | max_by([(.PY_VER|split(".")|map(tonumber))]) | [.]
4258
script: ci/test_python.sh
59+
permissions:
60+
actions: read
61+
contents: read
62+
id-token: write
63+
packages: read
64+
pull-requests: read
4365
wheel-build:
4466
needs: checks
45-
secrets: inherit
67+
secrets: inherit # zizmor: ignore[secrets-inherit]
4668
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-25.10
4769
with:
4870
build_type: pull-request
@@ -53,12 +75,24 @@ jobs:
5375
package-type: python
5476
pure-wheel: true
5577
append-cuda-suffix: false
78+
permissions:
79+
actions: read
80+
contents: read
81+
id-token: write
82+
packages: read
83+
pull-requests: read
5684
wheel-tests:
5785
needs: wheel-build
58-
secrets: inherit
86+
secrets: inherit # zizmor: ignore[secrets-inherit]
5987
uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-25.10
6088
with:
6189
build_type: pull-request
6290
# This selects the latest supported Python
6391
matrix_filter: max_by([(.PY_VER|split(".")|map(tonumber))]) | [.]
6492
script: "ci/test_wheel.sh"
93+
permissions:
94+
actions: read
95+
contents: read
96+
id-token: write
97+
packages: read
98+
pull-requests: read

.github/workflows/trigger-breaking-change-alert.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
name: Trigger Breaking Change Notifications
2-
3-
on:
2+
# `zizmor` always flags these triggers because they are easy to use
3+
# incorrectly. These usages are ok and don't execute any PR-specific
4+
# code (and so aren't susceptible to exploits from forked PRs)
5+
on: # zizmor: ignore[dangerous-triggers]
46
pull_request_target:
57
types:
68
- closed
79
- reopened
810
- labeled
911
- unlabeled
10-
12+
permissions: {}
1113
jobs:
1214
trigger-notifier:
1315
if: contains(github.event.pull_request.labels.*.name, 'breaking')
14-
secrets: inherit
16+
secrets: inherit # zizmor: ignore[secrets-inherit]
1517
uses: rapidsai/shared-workflows/.github/workflows/breaking-change-alert.yaml@branch-25.10
1618
with:
1719
sender_login: ${{ github.event.sender.login }}
@@ -24,3 +26,9 @@ jobs:
2426
pr_author: ${{ github.event.pull_request.user.login }}
2527
event_action: ${{ github.event.action }}
2628
pr_merged: ${{ github.event.pull_request.merged }}
29+
permissions:
30+
actions: read
31+
contents: read
32+
id-token: write
33+
packages: read
34+
pull-requests: read

.github/zizmor.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
rules:
2+
unpinned-uses:
3+
config:
4+
policies:
5+
# We require SHA-pinning for all workflows and actions _except_ for those from
6+
# rapidsai/shared-workflows and rapidsai/shared-actions
7+
"rapidsai/shared-workflows/*": any
8+
"rapidsai/shared-actions/*": any
9+
"*": hash-pin

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,9 @@ repos:
2323
hooks:
2424
- id: rapids-dependency-file-generator
2525
args: ['--clean']
26+
- repo: https://github.com/zizmorcore/zizmor-pre-commit
27+
rev: v1.24.1
28+
hooks:
29+
- id: zizmor
2630
default_language_version:
2731
python: python3

0 commit comments

Comments
 (0)