This commit is contained in:
mrT23
2023-11-08 14:46:11 +02:00
parent 49725e92f2
commit c2bec614e5

View File

@ -328,20 +328,26 @@ def set_custom_labels(variables):
variables["custom_labels_examples"] = f" - {list(labels.keys())[0]}" variables["custom_labels_examples"] = f" - {list(labels.keys())[0]}"
def get_user_labels(current_labels): def get_user_labels(current_labels: List[str] = None):
## Only keep labels that has been added by the user """
if current_labels is None: Only keep labels that has been added by the user
current_labels = [] """
user_labels = [] try:
for label in current_labels: if current_labels is None:
if label in ['Bug fix', 'Tests', 'Refactoring', 'Enhancement', 'Documentation', 'Other']: current_labels = []
continue user_labels = []
if get_settings().config.enable_custom_labels: for label in current_labels:
if label in get_settings().custom_labels: if label.lower() in ['bug fix', 'tests', 'refactoring', 'enhancement', 'documentation', 'other']:
continue continue
user_labels.append(label) if get_settings().config.enable_custom_labels:
if user_labels: if label in get_settings().custom_labels:
get_logger().info(f"Keeping user labels: {user_labels}") continue
user_labels.append(label)
if user_labels:
get_logger().info(f"Keeping user labels: {user_labels}")
except Exception as e:
get_logger().exception(f"Failed to get user labels: {e}")
return current_labels
return user_labels return user_labels