Skip to content

Commit

Permalink
fix Update changelog in api generator (#675)
Browse files Browse the repository at this point in the history
Signed-off-by: saimedhi <saimedhi@amazon.com>
  • Loading branch information
saimedhi committed Feb 9, 2024
1 parent 8b91bb4 commit b2638fb
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions utils/generate_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,17 +779,18 @@ def dump_modules(modules: Any) -> None:

with open("CHANGELOG.md", "r+", encoding="utf-8") as file:
content = file.read()
if "### Updated APIs" in content:
file_content = content.replace(
"### Updated APIs",
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.truncate()
else:
raise Exception("'Updated APIs' section is not present in CHANGELOG.md")
if commit_url not in content:
if "### Updated APIs" in content:
file_content = content.replace(
"### Updated APIs",
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.truncate()
else:
raise Exception("'Updated APIs' section is not present in CHANGELOG.md")


if __name__ == "__main__":
Expand Down

0 comments on commit b2638fb

Please sign in to comment.