refactor(changelog): update changelog generation process and format#1528
refactor(changelog): update changelog generation process and format#1528Ipriyankrajai wants to merge 5 commits into
Conversation
- Changed the prompt for generating changelogs to reflect version-based entries instead of weekly ones. - Updated instructions to find PRs merged since the previous tag and to check for existing changelogs based on version. - Modified the changelog file naming convention to include the version number. - Enhanced the changelog output format to include version information in the frontmatter and display it in the changelog entries. - Updated GitHub Actions workflow to trigger on tag pushes and extract version information for changelog generation.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughReplaces date-based changelog generation with a version-based workflow: extract/validate VERSION from release tag or input, drive prompts/branch/PR naming and file frontmatter by VERSION, add version-aware date formatting across changelog utilities, UI components, and RSS feed titles. Changes
Sequence DiagramsequenceDiagram
participant Git as Git (tag push / dispatch)
participant WF as GitHub Workflow
participant AI as Claude Code
participant Gen as Changelog Generator
participant UI as Marketing UI / Feed
Git->>WF: tag push or workflow_dispatch
WF->>WF: extract & validate VERSION (from tag or input)
WF->>AI: invoke prompt prefixed with "Version: X.Y.Z"
AI->>Gen: produce changelog file with frontmatter `version: X.Y.Z`
Gen->>WF: commit file and open PR `changelog/vX.Y.Z-{RUN_ID}`
WF->>UI: merged file available
UI->>UI: render entries using formatVersionDate(version, date)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In @.github/prompts/generate-changelog.md:
- Around line 27-29: The "check for existing changelog" step currently looks for
the full filename including the date and will miss previously created files when
a tag is re-pushed on a different date; update that check to match only the
version suffix (e.g., search for files matching "*-v{version}.mdx" or use a
regex like /-v\d+\.\d+\.\d+\.mdx$/) instead of the full "YYYY-MM-DD-vX.Y.Z.mdx"
string so duplicates are detected; modify the code that builds and compares
filenames in the "check for existing changelog" logic to extract or match on the
version portion (the "-vX.Y.Z.mdx" suffix) when deciding whether a changelog for
this version already exists.
In @.github/workflows/generate-changelog.yml:
- Around line 27-40: The VERSION extraction step (step id "version" using
INPUT_VERSION and GITHUB_REF) lacks sanitization and uses unquoted $VERSION
elsewhere; add validation to this step that accepts only a strict semantic
version pattern (e.g., regex like ^[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9.-]+)?$),
strip any surrounding whitespace, and fail the job with a clear message if the
input doesn't match; when deriving from GITHUB_REF keep the existing parameter
expansion but still validate the result; export the validated value to
GITHUB_ENV/GITHUB_OUTPUT (e.g., VALID_VERSION) and replace all downstream uses
(branch creation, commit message, Claude prompt) to reference the validated
variable and always quote it in shell contexts ("${VALID_VERSION}") to prevent
injection or invalid branch names.
In `@apps/marketing/src/app/changelog.xml/route.ts`:
- Line 29: The <title> construction interpolates entry.version directly (in the
expression `${entry.version ? `v${entry.version} — ` :
""}${escapeXml(entry.title)}`) which is inconsistent with the XML-escaping used
for entry.title; update this to XML-escape the version component by passing the
version string through escapeXml (e.g., wrap the `v${entry.version} — ` portion
with escapeXml or escape only entry.version before composing) so that the entire
title content is safely escaped using the existing escapeXml helper.
🧹 Nitpick comments (3)
.github/prompts/generate-changelog.md (1)
9-12:git describe … HEAD^may not find the correct previous tag.
git describe --tags --abbrev=0 --match "desktop-v*" HEAD^finds the nearest reachable tag from the parent of HEAD, which only works when HEAD is the tagged commit itself. If the workflow checks outmainor a detached HEAD at a different point, this won't reliably return the previous release tag. The fallback (git tag --sort=-v:refname … | head -2 | tail -1) is more robust — consider making it the primary recommendation or dropping thegit describevariant to avoid confusion for the AI agent..github/workflows/generate-changelog.yml (1)
56-57:claude-codeinstalled globally vianpmwhile the rest of the project usesbun.Not a correctness issue, but installing
@anthropic-ai/claude-codewithnpmwhile using Bun for everything else is slightly inconsistent. This is fine ifclaude-codeis a standalone CLI tool that doesn't need to share the project's dependency tree, but worth noting for consistency.apps/marketing/src/app/changelog/components/ChangelogCard/ChangelogCard.tsx (1)
33-35: Consider extracting the repeated version-date formatting into a utility.The pattern
entry.version ? `v${entry.version} · ${formattedDate}` : formattedDateis duplicated acrossChangelogCard,ChangelogEntryLayout,opengraph-image, andChangelogEntry. A small helper inchangelog-utils.tswould centralize the format and make future changes (e.g., tweaking the separator or prefix) a one-line fix.♻️ Suggested helper in changelog-utils.ts
export function formatVersionDate(version: string | undefined, date: string): string { const formatted = formatChangelogDate(date); return version ? `v${version} · ${formatted}` : formatted; }
- Updated changelog generation instructions to improve clarity on finding previous tags and checking for existing changelogs. - Introduced a new `formatVersionDate` utility to standardize version and date formatting across changelog components. - Replaced instances of `formatChangelogDate` with `formatVersionDate` in various changelog components for consistency. - Adjusted the changelog XML route to correctly format version titles. - Updated GitHub Actions workflow to validate version format during changelog generation.
|
Addressed all review feedback: Nitpick comments:
|
There was a problem hiding this comment.
🧹 Nitpick comments (2)
.github/workflows/generate-changelog.yml (1)
60-61: Pin@anthropic-ai/claude-codeto a specific version.An unpinned global install in CI means a breaking change or compromised release could silently break (or worse, compromise) this workflow. Pin it like Bun is pinned on Line 49.
Proposed fix
- name: Install Claude Code - run: bun install -g `@anthropic-ai/claude-code` + run: bun install -g `@anthropic-ai/claude-code`@0.2.61(Replace
0.2.61with whatever version you're currently using.).github/prompts/generate-changelog.md (1)
9-12: Tag-finding command could fail if there's only one tag.
git tag --sort=-v:refname -l "desktop-v*" | head -2 | tail -1returns an empty string when only a singledesktop-v*tag exists (first release). Since this is a prompt for an AI agent that can reason about edge cases, it's low risk, but adding a brief note like "if no previous tag exists, include all PRs" would make the instruction more robust.
- Changed the GitHub Actions workflow to trigger on published release events instead of tag pushes. - Updated version extraction logic to derive version from release tags, improving clarity and consistency in version handling.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @.github/workflows/generate-changelog.yml:
- Around line 107-114: The PR body currently hardcodes the tag string
"desktop-v${VERSION}" in the --body section which can be misleading for
workflow_dispatch runs; update the workflow to conditionally include the tag
line by checking the trigger context (e.g., github.event_name or GITHUB_REF)
before adding `- **Tag**: desktop-v${VERSION}`, or change the wording to
indicate the tag is only applicable for release-triggered runs—modify the step
that builds the --body payload (the block using --body and VERSION) to either
omit the tag line when not on a release tag or append a conditional note
instead.
- Around line 74-76: The workflow currently injects the prompt via shell
expansion $(cat .github/prompts/generate-changelog.md) into the claude -p
argument which allows backticks/$ to be interpreted; change the invocation of
the claude CLI in the job to stop using command substitution and instead pass
the markdown prompt file via the CLI's safe input mechanism (e.g., use claude's
--input-file .github/prompts/generate-changelog.md or pipe the prompt on stdin)
while still prepending the "Version: $VERSION" text programmatically so the
claude -p invocation receives the Version header and the prompt content without
shell interpolation; update the claude -p call in the workflow accordingly (keep
the same --allowedTools flags).
🧹 Nitpick comments (1)
.github/workflows/generate-changelog.yml (1)
61-61: Pin@anthropic-ai/claude-codeto a specific version.The package version is unpinned, so each run may install a different version. A breaking change or behavioral shift in a new release could silently alter or break changelog generation. Pin it for reproducibility:
📌 Proposed fix
- run: bun install -g `@anthropic-ai/claude-code` + run: bun install -g `@anthropic-ai/claude-code`@2.1.42
…rity - Revised instructions for checking existing changelogs to use `grep` for better accuracy in identifying files with the specified version. - Changed the filename format for new changelog entries to use a descriptive slug instead of the version number, enhancing SEO and clarity in file identification.
…ndling - Updated the changelog generation script to use a more structured approach for outputting the version and prompt content. - Added conditional logic to include a tag line in the changelog based on the event type, enhancing clarity for release events. - Improved formatting of the changelog output to ensure consistent presentation of version information.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/generate-changelog.yml (1)
60-61: Pin@anthropic-ai/claude-codeto a specific version.The global install has no version constraint, so every run fetches whatever
latestresolves to. A breaking CLI change would silently break this workflow with no code change on your side.📌 Suggested fix
- name: Install Claude Code - run: bun install -g `@anthropic-ai/claude-code` + run: bun install -g `@anthropic-ai/claude-code`@2.1.42Pin to a version you've validated against. Current latest is
2.1.42.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/generate-changelog.yml around lines 60 - 61, The workflow step named "Install Claude Code" installs `@anthropic-ai/claude-code` without a version; update that step to pin the package to a specific validated version (e.g., append `@2.1.42` to `@anthropic-ai/claude-code`) so the bun install -g command installs a fixed CLI version and prevents silent breakage from upstream breaking changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/generate-changelog.yml:
- Around line 60-61: The workflow step named "Install Claude Code" installs
`@anthropic-ai/claude-code` without a version; update that step to pin the package
to a specific validated version (e.g., append `@2.1.42` to
`@anthropic-ai/claude-code`) so the bun install -g command installs a fixed CLI
version and prevents silent breakage from upstream breaking changes.
Description
Related Issues
Type of Change
Testing
Screenshots (if applicable)
Additional Notes
Summary by CodeRabbit