Skip to content

Commit b2638fb

Browse files
authored
fix Update changelog in api generator (opensearch-project#675)
Signed-off-by: saimedhi <[email protected]>
1 parent 8b91bb4 commit b2638fb

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

utils/generate_api.py

+12-11
Original file line numberDiff line numberDiff line change
@@ -779,17 +779,18 @@ def dump_modules(modules: Any) -> None:
779779

780780
with open("CHANGELOG.md", "r+", encoding="utf-8") as file:
781781
content = file.read()
782-
if "### Updated APIs" in content:
783-
file_content = content.replace(
784-
"### Updated APIs",
785-
f"### Updated APIs\n- Updated opensearch-py APIs to reflect [opensearch-api-specification@{latest_commit_sha[:7]}]({commit_url})",
786-
1,
787-
)
788-
file.seek(0)
789-
file.write(file_content)
790-
file.truncate()
791-
else:
792-
raise Exception("'Updated APIs' section is not present in CHANGELOG.md")
782+
if commit_url not in content:
783+
if "### Updated APIs" in content:
784+
file_content = content.replace(
785+
"### Updated APIs",
786+
f"### Updated APIs\n- Updated opensearch-py APIs to reflect [opensearch-api-specification@{latest_commit_sha[:7]}]({commit_url})",
787+
1,
788+
)
789+
file.seek(0)
790+
file.write(file_content)
791+
file.truncate()
792+
else:
793+
raise Exception("'Updated APIs' section is not present in CHANGELOG.md")
793794

794795

795796
if __name__ == "__main__":

0 commit comments

Comments
 (0)