Skip to content

Commit 52da3fe

Browse files
Update auto release (#33956)
* Update main.py * Update main.py
1 parent 91811ab commit 52da3fe

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

scripts/auto_release/main.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,13 @@ def edit_sdk_readme(content: List[str]):
238238

239239
modify_file(sdk_readme, edit_sdk_readme)
240240

241+
@property
242+
def readme_md_path(self)-> Path:
243+
return Path(self.spec_repo) / "specification" / self.spec_readme.split("specification/")[-1]
244+
241245
@property
242246
def readme_python_md_path(self)-> Path:
243-
return Path(self.spec_repo) / "specification" / self.spec_readme.split("specification/")[-1].replace("readme.md", "readme.python.md")
247+
return Path(str(self.readme_md_path).replace("readme.md", "readme.python.md"))
244248

245249
# Use the template to update readme and setup by packaging_tools
246250
@return_origin_path
@@ -255,7 +259,7 @@ def check_file_with_packaging_tool(self):
255259
title = line.replace("title:", "").strip(" \r\n")
256260
break
257261
else:
258-
log("{python_md} does not exist")
262+
log(f"{python_md} does not exist")
259263
os.chdir(Path(f'sdk/{self.sdk_folder}'))
260264
# add `title` and update `is_stable` in sdk_packaging.toml
261265
toml = Path(f"azure-mgmt-{self.package_name}") / "sdk_packaging.toml"
@@ -406,15 +410,18 @@ def check_package_size(self):
406410
def check_model_flatten(self):
407411
last_version = self.get_last_release_version()
408412
if last_version == "" or last_version.startswith("1.0.0b"):
413+
with open(self.readme_md_path, 'r') as file_in:
414+
readme_md_content = file_in.read()
415+
409416
with open(self.readme_python_md_path, 'r') as file_in:
410-
content = file_in.read()
417+
readme_python_md_content = file_in.read()
411418

412-
if "flatten-models: false" not in content and self.issue_link:
419+
if "flatten-models: false" not in readme_md_content and "flatten-models: false" not in readme_python_md_content and self.issue_link:
413420
api = Github(self.bot_token).get_repo("Azure/sdk-release-request")
414421
issue_number = int(self.issue_link.split('/')[-1])
415422
issue = api.get_issue(issue_number)
416423
assignee = issue.assignee.login if issue.assignee else ""
417-
message = "please set `flatten-models: false` in readme.python.md"
424+
message = "please set `flatten-models: false` in readme.md or readme.python.md"
418425
issue.create_comment(f'@{assignee}, {message}')
419426
raise Exception(message)
420427

0 commit comments

Comments
 (0)