2323
2424permissions :
2525 contents : read
26- pull-requests : write
2726
2827jobs :
2928 determine-test-scope :
@@ -164,7 +163,8 @@ jobs:
164163 with :
165164 fetch-depth : 1
166165 submodules : false
167- - uses : astral-sh/ruff-action@v3
166+ persist-credentials : false
167+ - uses : astral-sh/ruff-action@57714a7c8a2e59f32539362ba31877a1957dded1 # v3.5.1
168168 with :
169169 version : 0.11.11
170170 - name : Run ruff format
@@ -185,8 +185,24 @@ jobs:
185185 with :
186186 persist-credentials : false
187187
188+ - name : Install the latest version of uv
189+ uses : astral-sh/setup-uv@b75a909f75acd358c2196fb9a5f1299a9a8868a4 # v6.7.0
190+
188191 - name : Run zizmor 🌈
189- uses : zizmorcore/zizmor-action@e673c3917a1aef3c65c972347ed84ccd013ecda4 # v0.2.0
192+ run : uvx zizmor .github/workflows/* --format=sarif . > results.sarif
193+ env :
194+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
195+
196+ - name : Upload SARIF file
197+ uses : github/codeql-action/upload-sarif@192325c86100d080feab897ff886c34abd4c83a3 # v3.30.3
198+ with :
199+ sarif_file : results.sarif
200+ category : zizmor
201+
202+ - name : run zizmor directly # this gets a success or fail result
203+ run : uvx zizmor .github/workflows/*
204+ env :
205+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
190206
191207 lint-branch-name :
192208 needs : determine-test-scope
@@ -199,14 +215,16 @@ jobs:
199215 - name : extract-branch-name
200216 id : extract-branch-name
201217 run : |
202- BRANCH_NAME="${{ github.head_ref } }"
218+ BRANCH_NAME="${GITHUB_HEAD_REF }"
203219 echo "Branch name: $BRANCH_NAME"
204220 echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
205221
206222 - name : enforce-jira-key
207223 id : enforce-jira-key
224+ env :
225+ STEPS_EXTRACT_BRANCH_NAME_OUTPUTS_BRANCH_NAME : ${{ steps.extract-branch-name.outputs.branch_name }}
208226 run : |
209- BRANCH_NAME="${{ steps.extract-branch-name.outputs.branch_name } }"
227+ BRANCH_NAME="${STEPS_EXTRACT_BRANCH_NAME_OUTPUTS_BRANCH_NAME }"
210228 echo $BRANCH_NAME
211229 JIRA_PATTERN='[A-Z]{2,}-[0-9]+'
212230
@@ -246,6 +264,7 @@ jobs:
246264 uses : actions/checkout@v4
247265 with :
248266 fetch-depth : 0 # fetch all commits in the PR
267+ persist-credentials : false
249268
250269 - name : Setup node
251270 uses : actions/setup-node@v4
@@ -264,9 +283,11 @@ jobs:
264283
265284 - name : Check commit messages (merge_group)
266285 if : github.event_name == 'merge_group'
286+ env :
287+ GITHUB_EVENT_MERGE_GROUP_HEAD_SHA : ${{ github.event.merge_group.head_sha }}
267288 run : |
268289 # For merge groups, check the commits being merged
269- npx commitlint --from ${{ github.event.merge_group.base_sha }} --to ${{ github.event.merge_group.head_sha } } --verbose || {
290+ npx commitlint --from ${{ github.event.merge_group.base_sha }} --to ${GITHUB_EVENT_MERGE_GROUP_HEAD_SHA } --verbose || {
270291 echo "Commit message linting failed; please follow the conventional commits format at https://www.conventionalcommits.org/"
271292 exit 1
272293 }
@@ -288,6 +309,7 @@ jobs:
288309 ref : ${{ github.event.pull_request.head.ref }}
289310 repository : ${{ github.event.pull_request.head.repo.full_name }}
290311 fetch-depth : 0
312+ persist-credentials : false
291313
292314 - name : git-config
293315 run : |
@@ -324,13 +346,16 @@ jobs:
324346
325347 - name : run-schema-diff
326348 id : schema-diff
349+ env :
350+ GITHUB_EVENT_PULL_REQUEST_BASE_REPO_FULL_NAME : ${{ github.event.pull_request.base.repo.full_name }}
351+ GITHUB_EVENT_PULL_REQUEST_BASE_REF : ${{ github.event.pull_request.base.ref }}
327352 run : |
328353 set -euo pipefail
329354 cd "$GITHUB_WORKSPACE"
330355
331356 # Determine base repo/ref for PRs; default to current repo and 'develop' otherwise
332- BASE_REPO="${{ github.event.pull_request.base.repo.full_name } }"
333- BASE_REF="${{ github.event.pull_request.base.ref } }"
357+ BASE_REPO="${GITHUB_EVENT_PULL_REQUEST_BASE_REPO_FULL_NAME }"
358+ BASE_REF="${GITHUB_EVENT_PULL_REQUEST_BASE_REF }"
334359 if [ -z "$BASE_REPO" ]; then
335360 BASE_REPO="${{ github.repository }}"
336361 fi
@@ -375,9 +400,11 @@ jobs:
375400
376401 - name : verify-allowed-changes
377402 if : steps.schema-diff.outputs.changed == 'true'
403+ env :
404+ STEPS_GET_VERSION_OUTPUTS_VERSION : ${{ steps.get-version.outputs.version }}
378405 run : |
379406 set -e
380- version="${{ steps.get-version.outputs.version } }"
407+ version="${STEPS_GET_VERSION_OUTPUTS_VERSION }"
381408 if [[ "$version" == *rc* ]]; then
382409 echo "✅ Passing: Schema changed on a release candidate version ($version), which is permitted."
383410 else
@@ -403,12 +430,14 @@ jobs:
403430 env : # Set environment variables for the whole job
404431 PIP_ONLY_BINARY : gdstk
405432 MPLBACKEND : agg
406-
433+ permissions :
434+ pull-requests : write
407435 steps :
408436 - uses : actions/checkout@v4
409437 with :
410438 fetch-depth : 0 # Required 0 for diff report.
411439 submodules : false
440+ persist-credentials : false
412441
413442 - name : install-project
414443 env :
@@ -449,11 +478,13 @@ jobs:
449478 matrix.python-version == '3.13' &&
450479 github.event_name == 'pull_request' &&
451480 !contains(github.event.pull_request.labels.*.name, 'ignore_diff_coverage')
481+ env :
482+ GITHUB_EVENT_PULL_REQUEST_BASE_REF : ${{ github.event.pull_request.base.ref }}
452483 run : |
453484 source ${GITHUB_WORKSPACE}/.venv/bin/activate
454485 git config --global --add safe.directory ${GITHUB_WORKSPACE}
455486 diff-cover ${GITHUB_WORKSPACE}/coverage.xml \
456- --compare-branch origin/${{ github.event.pull_request.base.ref } } \
487+ --compare-branch origin/${GITHUB_EVENT_PULL_REQUEST_BASE_REF } \
457488 --format markdown:diff-coverage.md
458489
459490 - uses : actions/github-script@v7
@@ -519,9 +550,10 @@ jobs:
519550 with :
520551 fetch-depth : 1
521552 submodules : false
553+ persist-credentials : false
522554
523555 - name : install-poetry
524- uses : snok/install-poetry@v1
556+ uses : snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1
525557 with :
526558 version : 2.1.1
527559 virtualenvs-create : true
@@ -534,7 +566,6 @@ jobs:
534566
535567 - name : install-project
536568 shell : bash
537- if : ${{ matrix.platform }} != "windows-latest"
538569 run : |
539570 poetry --version
540571 python --version
@@ -570,7 +601,7 @@ jobs:
570601 - name : create-badge
571602 if : ${{ github.ref == 'refs/heads/develop' }}
572603 # https://gist.githubusercontent.com/nedbat/8c6980f77988a327348f9b02bbaf67f5
573- uses : schneegans/dynamic-badges-action@v1.7.0
604+ uses : schneegans/dynamic-badges-action@e9a478b16159b4d31420099ba146cdc50f134483 # v1.7.0
574605 with :
575606 auth : ${{ secrets.GH_TIDY3D_COVERAGE_GIST }}
576607 gistID : 4702549574741e87deaadba436218ebd
@@ -598,15 +629,24 @@ jobs:
598629 - lint-branch-name
599630 - zizmor
600631 runs-on : ubuntu-latest
632+ env :
633+ NEEDS_LOCAL_TESTS_RESULT : ${{ needs.local-tests.result }}
634+ NEEDS_REMOTE_TESTS_RESULT : ${{ needs.remote-tests.result }}
635+ NEEDS_LINT_RESULT : ${{ needs.lint.result }}
636+ NEEDS_VERIFY_SCHEMA_CHANGE_RESULT : ${{ needs.verify-schema-change.result }}
637+ NEEDS_LINT_COMMIT_MESSAGES_RESULT : ${{ needs.lint-commit-messages.result }}
638+ NEEDS_LINT_BRANCH_NAME_RESULT : ${{ needs.lint-branch-name.result }}
639+ NEEDS_ZIZMOR_RESULT : ${{ needs.zizmor.result }}
601640 steps :
602641 - name : check-linting-result
603642 if : ${{ needs.lint.result != 'success' }}
604643 run : |
605644 echo "❌ Linting failed."
606645 exit 1
607-
646+
608647 - name : check-schema-change-verification
609648 if : ${{ needs.verify-schema-change.result != 'success' }}
649+
610650 run : |
611651 echo "❌ Schema change verification failed."
612652 exit 1
0 commit comments