Skip to content

Commit af7970d

Browse files
committed
chore: enhance changelog formatting and improve regex for version section extraction
1 parent 309f715 commit af7970d

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,12 @@ jobs:
6464
content = f.read()
6565
6666
# Look for version section (matches [X.X.X] or [Unreleased])
67-
version_pattern = rf'\[{re.escape(version)}\].*?(?=\n## |\n\[|$)'
68-
match = re.search(version_pattern, content, re.DOTALL | re.MULTILINE)
67+
pattern = rf'## \[{re.escape(version)}\][^\n]*\n(.*?)(?=\n## |\Z)'
68+
match = re.search(pattern, content, re.DOTALL)
6969
7070
if match:
71-
# Extract the content and clean it up
72-
section = match.group(0)
73-
# Remove the version header line
74-
lines = section.split('\n')[1:]
75-
# Remove empty lines at the start
76-
while lines and not lines[0].strip():
77-
lines.pop(0)
78-
changelog_content = '\n'.join(lines).strip()
71+
# Extract the content directly from capture group
72+
changelog_content = match.group(1).strip()
7973
8074
if changelog_content:
8175
print(changelog_content)

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515

1616
### Changed
1717
- 🧹 **Code Quality**: Improved code readability and maintainability in release management scripts
18+
1819
## [0.3.1] - 2025-01-02
1920

2021
### Added

0 commit comments

Comments
 (0)