This is an automated email from the ASF dual-hosted git repository.

tn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git


The following commit(s) were added to refs/heads/main by this push:
     new 8e43e98  add workflow to run pre-commit hooks for PRs
8e43e98 is described below

commit 8e43e9844827d88463c7dce1dfbecacc5e13b622
Author: Thomas Neidhart <[email protected]>
AuthorDate: Thu Mar 20 11:02:38 2025 +0100

    add workflow to run pre-commit hooks for PRs
---
 .github/workflows/{build.yml => analyze.yml} | 31 +++++++++++++---------------
 .github/workflows/build.yml                  |  2 +-
 2 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/analyze.yml
similarity index 60%
copy from .github/workflows/build.yml
copy to .github/workflows/analyze.yml
index 8d3272c..63fd253 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/analyze.yml
@@ -1,34 +1,26 @@
-name: Build and test
+name: Analyze using pre-commit hooks
 
 on:
-  push:
-    branches: [main]
   pull_request:
     branches: [main]
-  workflow_dispatch:
 
 permissions:
   contents: read
 
 env:
   LATEST_PY_VERSION: '3.13'
-  POETRY_VERSION: '2.0.1'
+  POETRY_VERSION: '2.1.1'
 
 jobs:
-  test:
+  analyze:
     runs-on: ubuntu-latest
-    strategy:
-      fail-fast: false
-      matrix:
-        python-version:
-          - '3.13'
     steps:
       - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 
v4.2.2
         with:
           persist-credentials: false
       - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # 
v5.4.0
         with:
-          python-version: ${{ matrix.python-version }}
+          python-version: ${{ env.LATEST_PY_VERSION }}
       - uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # 
v1.4.1
         with:
           virtualenvs-in-project: true
@@ -40,12 +32,17 @@ jobs:
         uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
         with:
           path: .venv
-          key: venv-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') 
}}
+          key: venv-${{ env.LATEST_PY_VERSION }}-${{ hashFiles('poetry.lock') 
}}
       - name: Install dependencies
         #if: steps.cache.outputs.cache-hit != 'true'
-        run: poetry sync -v --without=dev
+        run: poetry sync -v --with=dev
+
+      - name: Cache pre-commit data
+        uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
+        with:
+          path: ~/.cache/pre-commit
+          key: pre-commit-3|${{ env.pythonLocation }}|${{ 
hashFiles('.pre-commit-config.yaml') }}
 
-      # Run tests
-      - name: Run tests
+      - name: Run pre-commit
         run: |
-          poetry run pytest -rs tests
+          poetry run pre-commit run --show-diff-on-failure --color=always 
--all-files
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 8d3272c..b7a5fd7 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -12,7 +12,7 @@ permissions:
 
 env:
   LATEST_PY_VERSION: '3.13'
-  POETRY_VERSION: '2.0.1'
+  POETRY_VERSION: '2.1.1'
 
 jobs:
   test:


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to