diff --git a/scripts/auto_release/main.py b/scripts/auto_release/main.py index 34e56022cd2e..89f44635cbf6 100644 --- a/scripts/auto_release/main.py +++ b/scripts/auto_release/main.py @@ -265,8 +265,9 @@ def edit_file_for_pprint_name(content: List[str]): content[i] = content[i].replace('MyService', pprint_name) for file in os.listdir(self.sdk_code_path()): - if os.path.isfile(file): - modify_file(file, edit_file_for_pprint_name) + file_path = str(Path(self.sdk_code_path()) / file) + if os.path.isfile(file_path): + modify_file(file_path, edit_file_for_pprint_name) log(f' replace \"MyService\" with \"{pprint_name}\" successfully ') def get_all_files_under_package_folder(self) -> List[str]: @@ -367,7 +368,7 @@ def edit_changelog_for_new_service(self): def edit_changelog_for_new_service_proc(content: List[str]): for i in range(0, len(content)): if '##' in content[i]: - content[i] = f'## {self.next_version}({current_time()})' + content[i] = f'## {self.next_version}({current_time()})\n' break modify_file(str(Path(self.sdk_code_path()) / 'CHANGELOG.md'), edit_changelog_for_new_service_proc) @@ -410,6 +411,12 @@ def check_file(self): def sdk_code_path(self) -> str: return str(Path(f'sdk/{self.sdk_folder}/azure-mgmt-{self.package_name}')) + @property + def is_single_path(self) -> bool: + path = str(Path(f'sdk/{self.sdk_folder}')) + num = sum([os.path.isdir(str(Path(f'{path}/{listx}'))) for listx in os.listdir(path)]) + return num == 1 + @return_origin_path def install_package_locally(self): os.chdir(self.sdk_code_path()) @@ -454,6 +461,8 @@ def create_pr_proc(self): pr_head = "{}:{}".format(os.getenv('USR_NAME'), self.new_branch) pr_base = 'main' pr_body = "{} \n{} \n{}".format(self.issue_link, self.test_result, self.pipeline_link) + if not self.is_single_path: + pr_body += f'\nBuildTargetingString\n azure-mgmt-{self.package_name}\nSkip.CreateApiReview\ntrue' res_create = api.pulls.create(pr_title, pr_head, pr_base, pr_body) # Add issue link on PR