From cb7f1bd3fd2321b369be7b811e92992faca00d17 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Wed, 28 Jan 2026 17:45:40 +1000 Subject: [PATCH] Update pre-commit.yml --- .github/workflows/pre-commit.yml | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 628789a..5a1b1e2 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -1,26 +1,35 @@ name: pre-commit +permissions: + contents: read + on: [pull_request] jobs: pre-commit: - name: Run pre-commit # https://pre-commit.com/ + name: Run pre-commit runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 # https://www.python.org/ + - name: Checkout Code + uses: actions/checkout@v6 + with: + # Fetch all history so pre-commit can compare if needed + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v6 with: - python-version: "3.x" # Version range or exact version of a Python version to use, using SemVer's version range syntax + python-version: "3.x" architecture: "x64" # optional x64 or x86. Defaults to x64 if not specified - - name: Install dependencies # https://pip.pypa.io/en/stable/ + - name: Install dependencies run: | python -m pip install --upgrade pip pip install pre-commit - name: Set PY run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV - - uses: actions/cache@v3 + - name: Cache Pre-commit Hooks + uses: actions/cache@v4 with: path: ~/.cache/pre-commit key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} - - name: Run pre-commit - run: pre-commit run --all-files + - name: Run pre-commit hooks + run: pre-commit run --all-files --show-diff-on-failure --color always