Improve changelog automation prompt#9070
Conversation
📝 WalkthroughWalkthroughUpdates the changelog generation script's SYSTEM_PROMPT with stricter formatting/terminology rules, adds Go version normalization and extraction helpers, introduces a CHANGELOG_PATH environment variable override, and changes feature-release heading/anchor and Go Version section output logic. ChangesChangelog Generator Updates
Estimated code review effort: 2 (Simple) | ~15 minutes Sequence Diagram(s)sequenceDiagram
participant Main as main()
participant Env as Environment
participant Changelog as CHANGELOG.md
participant GoVer as Go Version Helpers
Main->>Env: read CHANGELOG_PATH (default CHANGELOG.md)
Main->>GoVer: resolve Go version (GO_VERSION or extract from changelog)
GoVer->>Changelog: read previous changelog if GO_VERSION not set
GoVer-->>Main: normalized Go version (v-prefixed)
Main->>Changelog: write updated changelog entry with feature-release heading and Go Version section
Related Issues: None found in the provided context. Related PRs: None found in the provided context. Suggested labels: documentation, tooling Suggested reviewers: None specified. Poem: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Pull request overview
This PR updates the changelog generation script used by the docs repo workflow to (a) refine the AI system prompt used for release-note polishing and (b) improve Go version handling so the generated ### Go Version section includes a concrete version even when GO_VERSION isn’t provided.
Changes:
- Expanded the Claude system prompt with stricter formatting/terminology rules (including DM/GM expansion and one-section-per-note).
- Added helpers to normalize Go versions and to extract the previously documented Go version from the existing changelog when
GO_VERSIONis empty. - Updated feature-release anchors/headings to use the
-feature-releasesuffix and adjusted how the Go Version section is rendered.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/scripts/generate_changelog.py (1)
282-296: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winRegex is tightly coupled to the exact string this script emits; likely won't match the live changelog's actual historical phrasing.
Since
CHANGELOG_PATHis wired to the publishedmattermost-v11-changelog.md(per the workflow),extract_previous_go_versionscans real content. The actual published changelog historically phrases Go version updates as plain sentences, not"is built with Go \`vX``"— e.g. "Upgraded Go to 1.25.8." and "Updated Go to v1.25.10." Until the new### Go Versionphrasing from this script has been written into the file at least once, this regex will find no match and silently fall back to"(see previous release)"` with no warning printed.Consider logging when the fallback path is hit so a missing/unexpected version isn't silently baked into a published release note.
💡 Suggested fallback logging
if go_version: formatted_go = normalize_go_version(go_version) else: - formatted_go = extract_previous_go_version(changelog_path) or "(see previous release)" + formatted_go = extract_previous_go_version(changelog_path) + if not formatted_go: + print("⚠️ Could not determine Go version from GO_VERSION or previous changelog") + formatted_go = "(see previous release)"🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/scripts/generate_changelog.py around lines 282 - 296, The fallback in extract_previous_go_version is silent when the regex does not match the existing changelog content, which can leave release notes with an unintended “see previous release” version. Update generate_changelog.py so extract_previous_go_version (or its caller in the changelog generation flow) logs a clear warning when no Go version is found, using the existing logger/print path used by the script, and keep the previous-version lookup behavior unchanged otherwise.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.github/scripts/generate_changelog.py:
- Around line 282-296: The fallback in extract_previous_go_version is silent
when the regex does not match the existing changelog content, which can leave
release notes with an unintended “see previous release” version. Update
generate_changelog.py so extract_previous_go_version (or its caller in the
changelog generation flow) logs a clear warning when no Go version is found,
using the existing logger/print path used by the script, and keep the
previous-version lookup behavior unchanged otherwise.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e4ca094c-923c-4b5f-95f0-4fc0c668a42c
📒 Files selected for processing (1)
.github/scripts/generate_changelog.py
Summary
DM→Direct Message,GM→Group Message), one-section-per-note rule, and a new instruction Test image #10 ("Focus")normalize_go_version()andextract_previous_go_version()helpers so the Go Version section always shows a concrete version number (looked up from the existing changelog whenGO_VERSIONis not provided)-feature-releasesuffix to match the ESR pattern, and includes the full release-policy URLCHANGELOG_PATHenv var is now read inmain()before building the Go sectiongo_sectionoutput changed from a bullet point to a bare sentence matching Mattermost changelog conventionTest plan
go1.22.5andv1.22.5input formats-feature-releaseanchor suffix🤖 Generated with Claude Code