Improve changelog automation prompt#9091
Conversation
|
Newest code from mattermost has been published to preview environment for Git SHA 84f0dbd |
📝 WalkthroughWalkthroughThe changelog generator’s prompt rules and release-note parsing are refined. Feature releases now normalize Go versions, read prior versions from a configurable changelog path, and use updated anchors, headings, and Go-version text. ChangesChangelog generation
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Environment
participant generate_changelog.py
participant CHANGELOG.md
Environment->>generate_changelog.py: Provide GO_VERSION and CHANGELOG_PATH
generate_changelog.py->>CHANGELOG.md: Read previous Go version when GO_VERSION is absent
CHANGELOG.md-->>generate_changelog.py: Return documented Go version
generate_changelog.py->>generate_changelog.py: Normalize Go version and generate feature-release content
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Pull request overview
This PR updates the changelog generation script used by the docs repo workflow to produce Mattermost release-note entries with tighter formatting/terminology rules and more consistent Go version output.
Changes:
- Expanded the AI system prompt rules (formatting, terminology expansion for DM/GM, and “one section per note” guidance).
- Added helpers to normalize Go versions and to extract the previously documented Go version from the existing changelog when
GO_VERSIONisn’t provided. - Adjusted feature-release anchors/headings to use the
-feature-releasesuffix and updated the release-policy URL; movedCHANGELOG_PATHlookup earlier so Go version extraction can use it.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/scripts/generate_changelog.py (1)
298-321: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winAdd
encoding="utf-8"to file operations ininsert_changelog_entry.Lines 302 and 319 open
changelog_pathwithout specifyingencoding="utf-8", whileextract_previous_go_version(line 290) correctly specifies it. On systems where the default encoding is not UTF-8, this could causeUnicodeDecodeErrorwhen reading or produce garbled output when writing, especially since the changelog contains emoji and special characters from the generated entries.🔧 Proposed fix
if os.path.exists(changelog_path): - with open(changelog_path, "r") as f: + with open(changelog_path, "r", encoding="utf-8") as f: existing = f.read() @@ -316,2 +316,2 @@ - with open(changelog_path, "w") as f: + with open(changelog_path, "w", encoding="utf-8") as f: f.write(new_content)🤖 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 298 - 321, Add encoding="utf-8" to both open calls within insert_changelog_entry: the read operation loading existing changelog content and the write operation saving new_content, matching extract_previous_go_version’s file handling.
🤖 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.
Outside diff comments:
In @.github/scripts/generate_changelog.py:
- Around line 298-321: Add encoding="utf-8" to both open calls within
insert_changelog_entry: the read operation loading existing changelog content
and the write operation saving new_content, matching
extract_previous_go_version’s file handling.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 100257d9-145d-43ea-ad9a-92a1f919b9e4
📒 Files selected for processing (1)
.github/scripts/generate_changelog.py
|
Newest code from mattermost has been published to preview environment for Git SHA 3d444df |
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 convention