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

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new bb4f04124ae Fix pin-versions prek hook and upgrade hooks (#57857)
bb4f04124ae is described below

commit bb4f04124aebd910ba5de3182634ce6bc6c4a076
Author: Jarek Potiuk <[email protected]>
AuthorDate: Wed Nov 5 23:44:06 2025 +0100

    Fix pin-versions prek hook and upgrade hooks (#57857)
    
    We had pin-versions prek-hook implemented in a separate workflow
    under the `dev` folder, but it has not been working since workspace
    switch because prek workspace only works on sub-folders of where the
    .pre-commit-config.yaml file is placed. It was in a separate file
    because it needed python 3.11 to run, but it is possible to have
    a specific python verison as separate language version in the hook
    itself, so we can move it back to the main .pre-commit-config.yaml
    
    This PR:
    
    * moves the pin-version hook to main .pre-commit-config.yaml
    * sets python 3.11 as version of python used in the hook independently
      from default python version
    * fix github actions and docs to use the hook from the main
      .pre-commit-config.yaml
---
 .github/workflows/ci-amd-arm.yml            |  4 +---
 .github/workflows/ci-notification.yml       |  5 -----
 .pre-commit-config.yaml                     |  9 +++++++++
 contributing-docs/08_static_code_checks.rst |  8 +++-----
 dev/.pre-commit-config.yaml                 | 28 ----------------------------
 5 files changed, 13 insertions(+), 41 deletions(-)

diff --git a/.github/workflows/ci-amd-arm.yml b/.github/workflows/ci-amd-arm.yml
index f42d4397a82..61ed86ffbab 100644
--- a/.github/workflows/ci-amd-arm.yml
+++ b/.github/workflows/ci-amd-arm.yml
@@ -204,9 +204,7 @@ jobs:
           platform: ${{ needs.build-info.outputs.platform }}
           save-cache: true
       - name: "Run pin-versions"
-        run: >
-          prek -c dev/.pre-commit-config.yaml --all-files --verbose 
--hook-stage manual
-          pin-versions
+        run: prek --all-files --verbose --hook-stage manual pin-versions
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 
diff --git a/.github/workflows/ci-notification.yml 
b/.github/workflows/ci-notification.yml
index d44c2d2706d..3b5fdfd31e5 100644
--- a/.github/workflows/ci-notification.yml
+++ b/.github/workflows/ci-notification.yml
@@ -45,11 +45,6 @@ jobs:
         with:
           persist-credentials: false
 
-      - name: "Install Python 3.11 as 3.11+ is needed by pin-versions 
pre-commit"
-        uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c  # 
v4.9.1
-        with:
-          python-version: 3.11
-
       - name: "Find workflow run status"
         id: find-workflow-run-status
         run: |
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index b651cf98bef..b733c31d67f 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -30,6 +30,15 @@ repos:
         description: Print input to the static check hooks for troubleshooting
       - id: check-hooks-apply
         name: Check if all hooks apply to the repository
+  - repo: https://github.com/eclipse-csi/octopin
+    # We need this commit because if supports two spaces before comments 
(yamllint compatibility)
+    rev: 21360742e352e87450f99e180fdfc2cf774a72a3
+    hooks:
+      - id: pin-versions
+        name: Pin versions of dependencies in CI workflows (manual)
+        stages: ['manual']
+        language: python
+        language_version: python311
   - repo: https://github.com/thlorenz/doctoc.git
     rev: 70fdcd39ef919754011a827bd25f23a0b141c3c3  # frozen: v2.2.0
     hooks:
diff --git a/contributing-docs/08_static_code_checks.rst 
b/contributing-docs/08_static_code_checks.rst
index 3760a864a8d..31f8e2e2f78 100644
--- a/contributing-docs/08_static_code_checks.rst
+++ b/contributing-docs/08_static_code_checks.rst
@@ -281,15 +281,13 @@ There is a separate prek ``pin-versions`` prek hook which 
is used to pin version
 GitHub Actions in the CI workflows.
 
 This action requires ``GITHUB_TOKEN`` to be set, otherwise you might hit the 
rate limits with GitHub API, it
-is also configured in a separate ``.prek-config.yaml`` file in the
-``dev`` directory as it requires Python 3.11 to run. It is not run 
automatically
-when you commit the code but in runs as a separate job in the CI. However, you 
can run it
-manually by running:
+It is not run automatically when you commit the code but in runs as a separate 
job in the CI.
+However, you can run it manually by running:
 
 .. code-block:: bash
 
     export GITHUB_TOKEN=YOUR_GITHUB_TOKEN
-    prek -c dev/.pre-commit-config.yaml --all-files --hook-stage manual 
--verbose
+    prek --all-files --hook-stage manual --verbose pin-versions
 
 
 Mypy checks
diff --git a/dev/.pre-commit-config.yaml b/dev/.pre-commit-config.yaml
deleted file mode 100644
index 69bb3b8c3c8..00000000000
--- a/dev/.pre-commit-config.yaml
+++ /dev/null
@@ -1,28 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
----
-default_stages: [manual]
-default_language_version:
-  python: python311
-minimum_prek_version: '0.0.26'
-repos:
-  - repo: https://github.com/eclipse-csi/octopin
-    rev: 21360742e352e87450f99e180fdfc2cf774a72a3
-    hooks:
-      - id: pin-versions
-        name: Pin versions of dependencies in CI workflows (manual)
-        stages: ['manual']

Reply via email to