forked from opensearch-project/opensearch-py
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sai Medhini Reddy Maryada <[email protected]>
- Loading branch information
Sai Medhini Reddy Maryada
authored and
Sai Medhini Reddy Maryada
committed
Mar 2, 2024
1 parent
4b69c09
commit 8472948
Showing
9 changed files
with
118 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# The OpenSearch Contributors require contributions made to | ||
# this file be licensed under the Apache-2.0 license or a | ||
# compatible open source license. | ||
# | ||
# Modifications Copyright OpenSearch Contributors. See | ||
# GitHub history for details. | ||
|
||
import requests | ||
|
||
|
||
def main() -> None: | ||
""" | ||
Updating the CHANGELOG.md | ||
""" | ||
response = requests.get( | ||
"https://api.github.com/repos/opensearch-project/opensearch-api-specification/commits" | ||
) | ||
if response.ok: | ||
commit_info = response.json()[0] | ||
commit_url = commit_info["html_url"] | ||
latest_commit_sha = commit_info.get("sha") | ||
else: | ||
raise Exception( | ||
f"Failed to fetch opensearch-api-specification commit information. Status code: {response.status_code}" | ||
) | ||
|
||
with open("CHANGELOG.md", "r+", encoding="utf-8") as file: | ||
content = file.read() | ||
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__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters