fix Update changelog in api generator (#675)
Signed-off-by: saimedhi <[email protected]>
This commit is contained in:
+12
-11
@@ -779,17 +779,18 @@ def dump_modules(modules: Any) -> None:
|
|||||||
|
|
||||||
with open("CHANGELOG.md", "r+", encoding="utf-8") as file:
|
with open("CHANGELOG.md", "r+", encoding="utf-8") as file:
|
||||||
content = file.read()
|
content = file.read()
|
||||||
if "### Updated APIs" in content:
|
if commit_url not in content:
|
||||||
file_content = content.replace(
|
if "### Updated APIs" in content:
|
||||||
"### Updated APIs",
|
file_content = content.replace(
|
||||||
f"### Updated APIs\n- Updated opensearch-py APIs to reflect [opensearch-api-specification@{latest_commit_sha[:7]}]({commit_url})",
|
"### Updated APIs",
|
||||||
1,
|
f"### Updated APIs\n- Updated opensearch-py APIs to reflect [opensearch-api-specification@{latest_commit_sha[:7]}]({commit_url})",
|
||||||
)
|
1,
|
||||||
file.seek(0)
|
)
|
||||||
file.write(file_content)
|
file.seek(0)
|
||||||
file.truncate()
|
file.write(file_content)
|
||||||
else:
|
file.truncate()
|
||||||
raise Exception("'Updated APIs' section is not present in CHANGELOG.md")
|
else:
|
||||||
|
raise Exception("'Updated APIs' section is not present in CHANGELOG.md")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user