Skip to content

Commit 79dc111

Browse files
committed
feat(changelog): update changelog generation to append to existing file
1 parent 1029fd5 commit 79dc111

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

Diff for: CHANGELOG.md

Whitespace-only changes.

Diff for: cliff.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ postprocessors = [
4646
# render_always = true
4747

4848
# 输出文件路径(默认写入 stdout)
49-
output = "CHANGELOG.md"
49+
# output = "CHANGELOG.md"
5050

5151
[git]
5252
# 使用 conventional commits 规范解析提交日志

Diff for: utils/bump.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,21 @@ def get_base_version(version: str) -> str:
9898

9999

100100
def generate_changelog(version: str):
101-
cmd = ["git-cliff", "--tag", f"v{version}", "-o", "CHANGELOG.md"]
101+
# 使用 --unreleased 和 --prepend 直接更新现有的 CHANGELOG.md
102+
cmd = [
103+
"git-cliff",
104+
"--tag",
105+
f"v{version}",
106+
"--unreleased",
107+
"--prepend",
108+
"CHANGELOG.md",
109+
]
102110
try:
103111
result = subprocess.run(cmd, capture_output=True, text=True)
104112
if result.returncode != 0:
105113
print(f"❌ changelog 生成失败: {result.stderr}")
106114
sys.exit(1)
107-
print("✅ changelog 已生成")
115+
print("✅ changelog 已更新并追加到 CHANGELOG.md")
108116
except Exception as e:
109117
print(f"❌ 执行 git-cliff 出错: {e}")
110118
sys.exit(1)

0 commit comments

Comments
 (0)