From 40ab70b8040f28ef907799b187975f301a9b1577 Mon Sep 17 00:00:00 2001 From: Dunedan Date: Sun, 9 Aug 2026 07:17:03 +0200 Subject: [PATCH] Inline the pre-commit/action Github action As the latest version of pre-commit is broken right now (https://github.com/pre-commit/pre-commit/issues/3737) and the official pre-commit Github action doesn't allow specifying an older pre-commit version to use, this inlines the logic of the pre-commit action into our action. --- .gitea/workflows/pre-commit.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/pre-commit.yml b/.gitea/workflows/pre-commit.yml index 82818bf3b4..1b74cb8bd4 100644 --- a/.gitea/workflows/pre-commit.yml +++ b/.gitea/workflows/pre-commit.yml @@ -3,22 +3,27 @@ name: pre-commit on: - push - pull_request +env: + PRE_COMMIT_VERSION: 4.6.0 jobs: - build: + pre-commit: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - uses: actions/setup-python@v7 with: python-version: "3.11" - - id: restore-pip-cache - uses: actions/cache/restore@v6 + - uses: actions/cache@v6 with: - key: pip-cache-v1-${{ github.workflow }} + key: pip-cache-v1-${{github.workflow}}-${{env.pythonLocation}}-${{env.PRE_COMMIT_VERSION}} path: ~/.cache/pip - - uses: pre-commit/action@v3.0.1 - - uses: actions/cache/save@v6 - if: steps.restore-pip-cache.outcome == 'success' + - run: python -m pip install pre-commit=="${{ env.PRE_COMMIT_VERSION }}" + shell: bash + - run: python -m pip freeze --local + shell: bash + - uses: actions/cache@v6 with: - key: pip-cache-v1-${{ github.workflow }} - path: ~/.cache/pip + path: ~/.cache/pre-commit + key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} + - run: pre-commit run --show-diff-on-failure --color=always --all-files + shell: bash