mirror of
https://github.com/anthropics/claude-code-sdk-python.git
synced 2025-12-23 09:19:52 +00:00
feat: add dates to changelog version headers
- Update generate-changelog.md to include dates in format (YYYY-MM-DD) - Add test to require dates for versions >= 0.1.19 - Add comment to create-release-tag.yml confirming date format support
This commit is contained in:
parent
04347495b8
commit
bc59a2162d
3 changed files with 42 additions and 1 deletions
|
|
@ -5,7 +5,7 @@ description: Generate changelog for a new release version
|
|||
|
||||
You are updating the changelog for the new release.
|
||||
|
||||
Update CHANGELOG.md to add a new section for the new version at the top of the file, right after the '# Changelog' heading.
|
||||
Update CHANGELOG.md to add a new section for the new version at the top of the file, right after the '# Changelog' heading. Use today's date in the version header in the format `## X.Y.Z (YYYY-MM-DD)` (e.g., `## 0.1.19 (2025-01-15)`).
|
||||
|
||||
Review the recent commits and merged pull requests since the last release to generate meaningful changelog content for the new version. Follow the existing format in CHANGELOG.md with sections like:
|
||||
- Breaking Changes (if any)
|
||||
|
|
|
|||
2
.github/workflows/create-release-tag.yml
vendored
2
.github/workflows/create-release-tag.yml
vendored
|
|
@ -43,6 +43,8 @@ jobs:
|
|||
VERSION="${{ steps.extract_version.outputs.version }}"
|
||||
|
||||
# Extract changelog section for this version to a temp file
|
||||
# Works with both "## X.Y.Z" and "## X.Y.Z (YYYY-MM-DD)" formats
|
||||
# since awk splits on whitespace ($2 is just the version number)
|
||||
awk -v ver="$VERSION" '
|
||||
/^## / {
|
||||
if (found) exit
|
||||
|
|
|
|||
|
|
@ -31,6 +31,45 @@ class TestChangelog:
|
|||
|
||||
assert len(versions) > 0, "Changelog should contain at least one version"
|
||||
|
||||
def test_new_versions_have_dates(self):
|
||||
"""Versions >= 0.1.19 should have dates in the format (YYYY-MM-DD)."""
|
||||
content = self.changelog_path.read_text()
|
||||
lines = content.split("\n")
|
||||
|
||||
# Version threshold for requiring dates (0.1.19 and above)
|
||||
date_required_threshold = (0, 1, 19)
|
||||
|
||||
version_with_date_pattern = re.compile(
|
||||
r"^## (\d+)\.(\d+)\.(\d+)\s+\((\d{4})-(\d{2})-(\d{2})\)$"
|
||||
)
|
||||
version_without_date_pattern = re.compile(r"^## (\d+)\.(\d+)\.(\d+)$")
|
||||
|
||||
for line in lines:
|
||||
if line.startswith("## "):
|
||||
# Try to match version with date first
|
||||
match_with_date = version_with_date_pattern.match(line)
|
||||
if match_with_date:
|
||||
# Validate date components
|
||||
year, month, day = (
|
||||
int(match_with_date.group(4)),
|
||||
int(match_with_date.group(5)),
|
||||
int(match_with_date.group(6)),
|
||||
)
|
||||
assert 2020 <= year <= 2100, f"Invalid year in date: {line}"
|
||||
assert 1 <= month <= 12, f"Invalid month in date: {line}"
|
||||
assert 1 <= day <= 31, f"Invalid day in date: {line}"
|
||||
continue
|
||||
|
||||
# Check if version without date
|
||||
match_without_date = version_without_date_pattern.match(line)
|
||||
if match_without_date:
|
||||
version_tuple = tuple(int(x) for x in match_without_date.groups())
|
||||
if version_tuple >= date_required_threshold:
|
||||
raise AssertionError(
|
||||
f"Version {line} is >= 0.1.19 and must have a date "
|
||||
f"in the format '## X.Y.Z (YYYY-MM-DD)'"
|
||||
)
|
||||
|
||||
def test_changelog_has_bullet_points(self):
|
||||
content = self.changelog_path.read_text()
|
||||
lines = content.split("\n")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue