From 90ec606dcf5804812884b9ab20020e7c1f59167b Mon Sep 17 00:00:00 2001 From: Tal Date: Sun, 17 Nov 2024 17:53:50 +0200 Subject: [PATCH] fixes --- .../commands/update_release_notes/update_rn.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/demisto_sdk/commands/update_release_notes/update_rn.py b/demisto_sdk/commands/update_release_notes/update_rn.py index 3e5a7f4386..b7160bc7a1 100644 --- a/demisto_sdk/commands/update_release_notes/update_rn.py +++ b/demisto_sdk/commands/update_release_notes/update_rn.py @@ -220,6 +220,15 @@ def create_rn_for_updated_content_item(path, _type, text): rn_desc += f'- {text or "%%UPDATE_RN%%"}\n' return rn_desc +def associated_types_diff(path, _type): + rn_desc = '' + old_json_file, new_json_file = get_json_objects(path, _type) + if new_associated_types := new_json_file.get('associatedTypes'): + old_associated_types = old_json_file.get('associatedTypes') + added_associated_types = [new_type for new_type in new_associated_types if new_type not in old_associated_types] + if added_associated_types: + rn_desc += f'- Added new associated types: {",".join(added_associated_types)}.\n' + return rn_desc def add_enhance_rn(_type, path, old_content_file, new_content_file): rn_desc = '' @@ -229,12 +238,7 @@ def add_enhance_rn(_type, path, old_content_file, new_content_file): elif _type == FileType.SCRIPT: rn_desc += find_diff(old_content_file.get("args"), new_content_file.get("args"), content_type.ARGUMENT) elif _type in (FileType.INCIDENT_FIELD): - old_json_file, new_json_file = get_json_objects(path, _type) - if new_associated_types := new_json_file.get('associatedTypes'): - old_associated_types = old_json_file.get('associatedTypes') - added_associated_types = [new_type for new_type in new_associated_types if new_type not in old_associated_types] - if added_associated_types: - rn_desc += f'- Added new associated types: {",".join(added_associated_types)}.\n' + rn_desc += associated_types_diff(path, _type) return rn_desc def get_deprecated_rn(old_yml, new_yml, file_type):