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

jedcunningham 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 a746defd6b Fix version heads map pre_commit rule (#33749)
a746defd6b is described below

commit a746defd6ba123b74d87ace4de01fd0a25932a64
Author: Jed Cunningham <[email protected]>
AuthorDate: Sat Aug 26 14:16:37 2023 -0600

    Fix version heads map pre_commit rule (#33749)
    
    Only run it when the map may have changed (migration or core version
    change), and also only check migration files (ignore things like
    pycache).
---
 .pre-commit-config.yaml                               | 1 +
 scripts/ci/pre_commit/pre_commit_version_heads_map.py | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 778b4d6db0..8f0b311399 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -412,6 +412,7 @@ repos:
         language: python
         entry: ./scripts/ci/pre_commit/pre_commit_version_heads_map.py
         pass_filenames: false
+        files: ^airflow/migrations/versions|^airflow/__init__.py$
         additional_dependencies: ['packaging','google-re2']
       - id: update-version
         name: Update version to the latest version in the documentation
diff --git a/scripts/ci/pre_commit/pre_commit_version_heads_map.py 
b/scripts/ci/pre_commit/pre_commit_version_heads_map.py
index b3461e78cc..296256aff1 100755
--- a/scripts/ci/pre_commit/pre_commit_version_heads_map.py
+++ b/scripts/ci/pre_commit/pre_commit_version_heads_map.py
@@ -46,6 +46,9 @@ def revision_heads_map():
     sorted_filenames = sorted(filenames, key=sorting_key)
 
     for filename in sorted_filenames:
+        if not filename.endswith(".py"):
+            print(f"skipping non-migration file: {filename}")
+            continue
         with open(os.path.join(MIGRATION_PATH, filename)) as file:
             content = file.read()
             revision_match = re2.search(pattern, content)

Reply via email to