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 4acb2c6b93 Fix assuming "Feature" answer on CI when generating docs
(#23640)
4acb2c6b93 is described below
commit 4acb2c6b93ed1cc3ec4b6aed60bbf6091a4e034f
Author: Jarek Potiuk <[email protected]>
AuthorDate: Wed May 11 13:15:22 2022 +0200
Fix assuming "Feature" answer on CI when generating docs (#23640)
We have now different answers posisble when generating docs, and
for testing we assume we answered randomly during the generation
of documentation.
---
dev/provider_packages/prepare_provider_packages.py | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/dev/provider_packages/prepare_provider_packages.py
b/dev/provider_packages/prepare_provider_packages.py
index 44ee3a9f90..0e3e27cd9a 100755
--- a/dev/provider_packages/prepare_provider_packages.py
+++ b/dev/provider_packages/prepare_provider_packages.py
@@ -37,6 +37,7 @@ from enum import Enum
from functools import lru_cache
from os.path import dirname, relpath
from pathlib import Path
+from random import choice
from shutil import copyfile
from typing import Any, Dict, Iterable, List, NamedTuple, Optional, Set,
Tuple, Union
@@ -1138,12 +1139,23 @@ class TypeOfChange(Enum):
SKIP = "s"
-def get_type_of_changes() -> TypeOfChange:
+def get_type_of_changes(answer: Optional[str]) -> TypeOfChange:
"""
Ask user to specify type of changes (case-insensitive).
:return: Type of change.
"""
given_answer = ""
+ if answer and answer.lower() in ["yes", "y"]:
+ # Simulate all possible non-terminal answers
+ return choice(
+ [
+ TypeOfChange.DOCUMENTATION,
+ TypeOfChange.BUGFIX,
+ TypeOfChange.FEATURE,
+ TypeOfChange.BREAKING_CHANGE,
+ TypeOfChange.SKIP,
+ ]
+ )
while given_answer not in [*[t.value for t in TypeOfChange], "q"]:
console.print(
"[yellow]Type of change (d)ocumentation, (b)ugfix, (f)eature,
(x)breaking "
@@ -1223,7 +1235,7 @@ def update_release_notes(
console.print()
return False
else:
- type_of_change = get_type_of_changes()
+ type_of_change = get_type_of_changes(answer=answer)
if type_of_change == TypeOfChange.DOCUMENTATION:
if isinstance(latest_change, Change):
mark_latest_changes_as_documentation_only(provider_package_id, latest_change)