This is an automated email from the ASF dual-hosted git repository. potiuk pushed a commit to branch v3-0-test in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-0-test by this push: new c3a927f29e9 [v3-0-test] Advanced auto classification for provider documentation (#52902) (#52925) c3a927f29e9 is described below commit c3a927f29e9bbe11d6e9147c0b0e064afa098cc3 Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> AuthorDate: Sun Jul 6 01:05:07 2025 +0200 [v3-0-test] Advanced auto classification for provider documentation (#52902) (#52925) (cherry picked from commit 19961713421885c8306d3a51a4c3eaf5f27f6cb7) Co-authored-by: Amogh Desai <amoghrajesh1...@gmail.com> --- .../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 c330047b7cd..b5f6a339cbd 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" @@ -214,7 +217,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. @@ -235,7 +238,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( @@ -827,7 +830,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 b55088987c6..6ff67e267d3 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/docs/slack.rst", @@ -429,6 +435,7 @@ def test_get_most_impactful_change(changes, expected): id="docs_and_real_code", ), pytest.param( + "slack", [ "providers/slack/src/airflow/providers/slack/hooks/slack.py", "providers/slack/tests/test_slack.py", @@ -436,10 +443,28 @@ def test_get_most_impactful_change(changes, expected): "other", id="real_code_and_tests", ), - 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