forked from phoenix-oss/llama-stack-mirror
fix: clean up detailed history for CHANGELOG (#1494)
# What does this PR do? - do not dump all commit history in CHANGELOG cc @terrytangyuan [//]: # (If resolving an issue, uncomment and update the line below) [//]: # (Closes #[issue-number]) ## Test Plan ``` python scripts/gen-changelog.py ``` [//]: # (## Documentation)
This commit is contained in:
parent
3b4f3a6b15
commit
9028407386
2 changed files with 221 additions and 1208 deletions
1022
CHANGELOG.md
1022
CHANGELOG.md
File diff suppressed because it is too large
Load diff
|
@ -4,9 +4,11 @@
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
import requests
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
|
|
||||||
def get_all_releases(token):
|
def get_all_releases(token):
|
||||||
url = f"https://api.github.com/repos/meta-llama/llama-stack/releases"
|
url = f"https://api.github.com/repos/meta-llama/llama-stack/releases"
|
||||||
headers = {"Accept": "application/vnd.github.v3+json"}
|
headers = {"Accept": "application/vnd.github.v3+json"}
|
||||||
|
@ -19,7 +21,33 @@ def get_all_releases(token):
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
return response.json()
|
return response.json()
|
||||||
else:
|
else:
|
||||||
raise Exception(f"Error fetching releases: {response.status_code}, {response.text}")
|
raise Exception(
|
||||||
|
f"Error fetching releases: {response.status_code}, {response.text}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def clean_release_body(body):
|
||||||
|
"""Remove '## All changes' sections from release notes."""
|
||||||
|
lines = body.split("\n")
|
||||||
|
cleaned_lines = []
|
||||||
|
skip_mode = False
|
||||||
|
|
||||||
|
for line in lines:
|
||||||
|
if line.strip() in [
|
||||||
|
"## All changes",
|
||||||
|
"### What's Changed",
|
||||||
|
"## What's Changed",
|
||||||
|
"## New Contributors",
|
||||||
|
]:
|
||||||
|
skip_mode = True
|
||||||
|
elif skip_mode and line.startswith("##"):
|
||||||
|
# Found a new section, stop skipping
|
||||||
|
skip_mode = False
|
||||||
|
cleaned_lines.append(line)
|
||||||
|
elif not skip_mode:
|
||||||
|
cleaned_lines.append(line)
|
||||||
|
|
||||||
|
return "\n".join(cleaned_lines)
|
||||||
|
|
||||||
|
|
||||||
def merge_release_notes(output_file, token=None):
|
def merge_release_notes(output_file, token=None):
|
||||||
|
@ -31,11 +59,16 @@ def merge_release_notes(output_file, token=None):
|
||||||
for release in releases:
|
for release in releases:
|
||||||
md_file.write(f"# {release['tag_name']}\n")
|
md_file.write(f"# {release['tag_name']}\n")
|
||||||
md_file.write(f"Published on: {release['published_at']}\n\n")
|
md_file.write(f"Published on: {release['published_at']}\n\n")
|
||||||
md_file.write(f"{release['body']}\n\n")
|
|
||||||
|
# Clean the release body to remove "## All changes" sections
|
||||||
|
cleaned_body = clean_release_body(release["body"])
|
||||||
|
md_file.write(f"{cleaned_body}\n\n")
|
||||||
|
|
||||||
md_file.write("---\n\n")
|
md_file.write("---\n\n")
|
||||||
|
|
||||||
print(f"Merged release notes saved to {output_file}")
|
print(f"Merged release notes saved to {output_file}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
OUTPUT_FILE = "CHANGELOG.md"
|
OUTPUT_FILE = "CHANGELOG.md"
|
||||||
TOKEN = os.getenv("GITHUB_TOKEN")
|
TOKEN = os.getenv("GITHUB_TOKEN")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue