From 52cd0d4cc7c95de72b70cab1f6aa8e993a649823 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Sun, 13 Jul 2025 10:11:01 +1000 Subject: [PATCH] Add v3 changelog validation workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .github/workflows/v3-check-changelog.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/v3-check-changelog.yml b/.github/workflows/v3-check-changelog.yml index 95e5eff2f..53c707ca1 100644 --- a/.github/workflows/v3-check-changelog.yml +++ b/.github/workflows/v3-check-changelog.yml @@ -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++ {