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 19961713421 Advanced auto classification for provider documentation 
(#52902)
19961713421 is described below

commit 19961713421885c8306d3a51a4c3eaf5f27f6cb7
Author: Amogh Desai <amoghrajesh1...@gmail.com>
AuthorDate: Sun Jul 6 03:43:11 2025 +0530

    Advanced auto classification for provider documentation (#52902)
---
 .../prepare_providers/provider_documentation.py    | 11 +++---
 dev/breeze/tests/test_provider_documentation.py    | 39 ++++++++++++++++++----
 2 files changed, 39 insertions(+), 11 deletions(-)

diff --git 
a/dev/breeze/src/airflow_breeze/prepare_providers/provider_documentation.py 
b/dev/breeze/src/airflow_breeze/prepare_providers/provider_documentation.py
index cef1cc9f764..e3e86d7c15e 100644
--- a/dev/breeze/src/airflow_breeze/prepare_providers/provider_documentation.py
+++ b/dev/breeze/src/airflow_breeze/prepare_providers/provider_documentation.py
@@ -195,7 +195,10 @@ TYPE_OF_CHANGE_DESCRIPTION = {
 }
 
 
-def classification_result(changed_files):
+def classification_result(provider_id, changed_files):
+    provider_path = f"providers/{provider_id}/"
+    changed_files = list(filter(lambda f: f.startswith(provider_path), 
changed_files))
+
     if not changed_files:
         return "other"
 
@@ -224,7 +227,7 @@ def classification_result(changed_files):
     return "other"
 
 
-def classify_provider_pr_files(commit_hash: str) -> str:
+def classify_provider_pr_files(provider_id: str, commit_hash: str) -> str:
     """
     Classify a provider commit based on changed files.
 
@@ -245,7 +248,7 @@ def classify_provider_pr_files(commit_hash: str) -> str:
         # safe to return other here
         return "other"
 
-    return classification_result(changed_files)
+    return classification_result(provider_id, changed_files)
 
 
 def _get_git_log_command(
@@ -837,7 +840,7 @@ def update_release_notes(
                 )
                 change = list_of_list_of_changes[0][table_iter]
 
-                classification = classify_provider_pr_files(change.full_hash)
+                classification = classify_provider_pr_files(provider_id, 
change.full_hash)
                 if classification == "documentation":
                     get_console().print(
                         f"[green]Automatically classifying change as 
DOCUMENTATION since it contains only doc changes:[/]\n"
diff --git a/dev/breeze/tests/test_provider_documentation.py 
b/dev/breeze/tests/test_provider_documentation.py
index f328edd44aa..8392a0aba14 100644
--- a/dev/breeze/tests/test_provider_documentation.py
+++ b/dev/breeze/tests/test_provider_documentation.py
@@ -395,16 +395,20 @@ def test_get_most_impactful_change(changes, expected):
 
 
 @pytest.mark.parametrize(
-    "changed_files, expected",
+    "provider_id, changed_files, expected",
     [
-        pytest.param(["providers/slack/docs/slack.rst"], "documentation", 
id="only_docs"),
-        pytest.param(["providers/slack/tests/test_slack.py"], 
"test_or_example_only", id="only_tests"),
+        pytest.param("slack", ["providers/slack/docs/slack.rst"], 
"documentation", id="only_docs"),
         pytest.param(
+            "slack", ["providers/slack/tests/test_slack.py"], 
"test_or_example_only", id="only_tests"
+        ),
+        pytest.param(
+            "slack",
             
["providers/slack/src/airflow/providers/slack/example_dags/example_notify.py"],
             "test_or_example_only",
             id="only_example_dags",
         ),
         pytest.param(
+            "slack",
             [
                 "providers/slack/tests/test_slack.py",
                 
"providers/slack/src/airflow/providers/slack/example_dags/example_notify.py",
@@ -413,6 +417,7 @@ def test_get_most_impactful_change(changes, expected):
             id="tests_and_example_dags",
         ),
         pytest.param(
+            "slack",
             [
                 "providers/slack/tests/test_slack.py",
                 "providers/slack/docs/slack.rst",
@@ -421,6 +426,7 @@ def test_get_most_impactful_change(changes, expected):
             id="docs_and_tests",
         ),
         pytest.param(
+            "slack",
             [
                 "providers/slack/src/airflow/providers/slack/hooks/slack.py",
                 "providers/slack/tests/test_slack.py",
@@ -429,6 +435,7 @@ def test_get_most_impactful_change(changes, expected):
             id="real_code_and_tests",
         ),
         pytest.param(
+            "slack",
             [
                 "providers/slack/src/airflow/providers/slack/hooks/slack.py",
                 "providers/slack/tests/test_slack.py",
@@ -437,10 +444,28 @@ def test_get_most_impactful_change(changes, expected):
             "other",
             id="docs_and_real_code",
         ),
-        pytest.param(["airflow/utils/db.py"], "other", id="non_provider_file"),
-        pytest.param([], "other", id="empty_commit"),
+        pytest.param(
+            "google",
+            [
+                "providers/google/tests/some_test.py",
+                "providers/amazon/tests/test_something.py",
+            ],
+            "test_or_example_only",
+            id="tests_in_multiple_providers",
+        ),
+        pytest.param(
+            "amazon",
+            [
+                "providers/google/tests/some_test.py",
+                "providers/amazon/tests/test_something.py",
+            ],
+            "test_or_example_only",
+            id="tests_in_multiple_providers",
+        ),
+        pytest.param("slack", ["airflow/utils/db.py"], "other", 
id="non_provider_file"),
+        pytest.param("slack", [], "other", id="empty_commit"),
     ],
 )
-def test_classify_provider_pr_files_logic(changed_files, expected):
-    result = classification_result(changed_files)
+def test_classify_provider_pr_files_logic(provider_id, changed_files, 
expected):
+    result = classification_result(provider_id, changed_files)
     assert result == expected

Reply via email to