From 3505a0c0b7cefe6776cf14c1f98c103ea9523b12 Mon Sep 17 00:00:00 2001 From: Federico Stagni Date: Sun, 15 Nov 2026 13:30:16 +0100 Subject: [PATCH 1/2] chore: add zizmor (pre-commit) and fix its auditor findings --- .../workflows/draft-on-changes-requested.yml | 18 +++++++++++++++--- .github/workflows/record-changes-requested.yml | 16 ++++++++++++++-- .pre-commit-config.yaml | 12 ++++++++++++ 3 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/draft-on-changes-requested.yml b/.github/workflows/draft-on-changes-requested.yml index 277e7b9..757e568 100644 --- a/.github/workflows/draft-on-changes-requested.yml +++ b/.github/workflows/draft-on-changes-requested.yml @@ -1,22 +1,33 @@ name: Draft on Changes Requested on: + # The workflow must run after "Record Changes Requested" completes, which + # requires workflow_run. + # zizmor: ignore[dangerous-triggers] the job only fetches a PR number artifact + # from the triggering run by id and delegates to the reusable workflow workflow_run: workflows: ["Record Changes Requested"] types: [completed] +# A new "Record Changes Requested" completion for the same head branch cancels +# the previous run. +concurrency: + group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch }} + cancel-in-progress: true + permissions: {} jobs: get-pr: + name: get-pr if: github.event.workflow_run.conclusion == 'success' runs-on: ubuntu-latest permissions: - actions: read + actions: read # download the pr-info artifact from the triggering run outputs: pr_number: ${{ steps.pr.outputs.number }} steps: - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: name: pr-info run-id: ${{ github.event.workflow_run.id }} @@ -25,8 +36,9 @@ jobs: run: echo "number=$(cat pr_number.txt)" >> "$GITHUB_OUTPUT" draft: + name: draft needs: get-pr - uses: DIRACGrid/.github/.github/workflows/draft-on-changes-requested.yml@main + uses: DIRACGrid/.github/.github/workflows/draft-on-changes-requested.yml@a599200da5df9e3ea9104a6b9b99eb5bf83754a3 with: pr_number: ${{ fromJSON(needs.get-pr.outputs.pr_number) }} secrets: diff --git a/.github/workflows/record-changes-requested.yml b/.github/workflows/record-changes-requested.yml index 7848f27..68b8fce 100644 --- a/.github/workflows/record-changes-requested.yml +++ b/.github/workflows/record-changes-requested.yml @@ -4,13 +4,25 @@ on: pull_request_review: types: [submitted] +# One run per pull request. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: false + +permissions: + contents: read + jobs: record: + name: record if: github.event.review.state == 'changes_requested' runs-on: ubuntu-latest steps: - - run: echo "${{ github.event.pull_request.number }}" > pr_number.txt - - uses: actions/upload-artifact@v4 + - name: Record the PR number + env: + PR_NUMBER: ${{ github.event.pull_request.number }} + run: echo "$PR_NUMBER" > pr_number.txt + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: pr-info path: pr_number.txt diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..b5d25bf --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,12 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks + +default_language_version: + python: python3.11 + +repos: + - repo: https://github.com/zizmorcore/zizmor-pre-commit + rev: v1.32.0 + hooks: + - id: zizmor + args: ["--no-online-audits"] From a44ae957f6bb44ebf0406569de641913c13ce1ba Mon Sep 17 00:00:00 2001 From: aldbr Date: Mon, 16 Nov 2026 17:45:40 +0100 Subject: [PATCH 2/2] ci: run zizmor in CI, keep its --no-progress, use python3 Master dropped the draft-on-changes-requested workflows (#8), so only the pre-commit part of this change remains. Align it with DIRACGrid/.github: - keep the hook's own --no-progress, which `args` would otherwise replace (zizmor#582) - python3 instead of python3.11, so the hook builds on any Python 3 - add the pre-commit workflow, so zizmor runs on every PR and not only where someone installed the hook Assisted-by: Claude:claude-opus-5-5 --- .github/workflows/pre-commit.yml | 27 +++++++++++++++++++++++++++ .pre-commit-config.yaml | 5 +++-- 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..92fb76b --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,27 @@ +name: pre-commit + +on: + push: + branches: [master] + pull_request: + branches: [master] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + pre-commit: + name: pre-commit + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + python-version: 3.x + - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b5d25bf..71a6ece 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,11 +2,12 @@ # See https://pre-commit.com/hooks.html for more hooks default_language_version: - python: python3.11 + python: python3 repos: - repo: https://github.com/zizmorcore/zizmor-pre-commit rev: v1.32.0 hooks: - id: zizmor - args: ["--no-online-audits"] + # Overrides the hook's own args, so keep its --no-progress (zizmor#582). + args: ["--no-progress", "--no-online-audits"]