Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'update changelog' in api generator #675

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading