Add v3 changelog validation workflow

This workflow validates changelog entries in PRs targeting v3-alpha branch:
- Detects entries added to already-released versions using diff analysis
- Automatically moves misplaced entries to [Unreleased] section
- Uses proper ### Category format for Keep a Changelog compliance
- Commits fixes back to PR with clear feedback

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Lea Anthony 2025-07-13 10:11:01 +10:00
commit 52cd0d4cc7

View file

@ -235,11 +235,20 @@ jobs:
if strings.HasPrefix(line, "### ") {
return strings.TrimSpace(line[4:])
}
if strings.HasPrefix(line, "## ") {
if strings.HasPrefix(line, "## ") &&
!strings.Contains(line, "[Unreleased]") &&
!strings.Contains(line, "v3.0.0-alpha") {
// This is a malformed category like "## Added" - should be "### Added"
// But we'll handle it for backward compatibility
return strings.TrimSpace(line[3:])
}
if strings.HasPrefix(line, "## ") &&
(strings.Contains(line, "[Unreleased]") || strings.Contains(line, "v3.0.0-alpha")) {
// This is a version section header, stop looking
break
}
}
return "Unknown"
return "Added" // Default fallback for new entries
}
func attemptFix(content string, issues []Issue) (bool, error) {
@ -301,7 +310,7 @@ jobs:
insertPos := unreleasedStart + 1
for i := unreleasedStart + 1; i < unreleasedEnd && i < len(lines); i++ {
if strings.Contains(lines[i], "### " + category) {
if strings.Contains(lines[i], "### " + category) || strings.Contains(lines[i], "## " + category) {
categoryFound = true
// Find the end of this category to append entries
for j := i + 1; j < unreleasedEnd && j < len(lines); j++ {