Skip to content

Commit

Permalink
fix Update changelog in api generator (opensearch-project#675)
Browse files Browse the repository at this point in the history
Signed-off-by: saimedhi <saimedhi@amazon.com>
  • Loading branch information
saimedhi authored and dblock committed Aug 15, 2024
1 parent 814159e commit d6344c2
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 d6344c2

Please sign in to comment.