feat: add automated changelog generation system#25
Conversation
- Add CHANGELOG.md with proper formatting and recent changes - Add GitHub Actions workflow for automatic changelog updates on merge - Workflow categorizes commits by type (feat/fix/refactor) into changelog sections 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThis pull request introduces automated changelog management to the project. A new GitHub Actions workflow is added to update the CHANGELOG.md file on every push to the main branch, ensuring that release notes are always current. The changelog itself is initialized using the Keep a Changelog format, documenting both the initial release and recent unreleased changes. This automation streamlines release documentation and enforces consistency in change tracking. Changes
Sequence DiagramThis diagram shows the interactions between components: sequenceDiagram
title Changelog Update Workflow on Merge to Main
actor Developer
participant GitHub as "GitHub"
participant WorkflowRunner as "GitHub Action Runner"
participant Git as "Git Commands"
participant GH_CLI as "GitHub CLI"
participant Filesystem as "Filesystem"
Developer->>GitHub: Merge PR to main branch
GitHub->>WorkflowRunner: Trigger "Update Changelog on Merge" workflow
Note over WorkflowRunner: Job: update-changelog
WorkflowRunner->>Git: Checkout code (actions/checkout@v4)
WorkflowRunner->>Git: Get latest merge commit info
Git-->>WorkflowRunner: Return merge message, hash, date
WorkflowRunner->>WorkflowRunner: Extract PR number from merge message
alt PR number found
WorkflowRunner->>GH_CLI: Request PR details (title, body)
GH_CLI-->>WorkflowRunner: Return PR details
end
WorkflowRunner->>Filesystem: Create backup of CHANGELOG.md
WorkflowRunner->>Filesystem: Extract changelog sections
Filesystem-->>WorkflowRunner: Return section positions
WorkflowRunner->>Git: Get commits from the merge
Git-->>WorkflowRunner: Return commit list
WorkflowRunner->>WorkflowRunner: Categorize changes
Note over WorkflowRunner: Loop through commits
loop For each commit
alt commit contains "feat:" or "add:"
WorkflowRunner->>WorkflowRunner: Add to ADDED category
else commit contains "fix:"
WorkflowRunner->>WorkflowRunner: Add to FIXED category
else commit contains "refactor:" or "update:"
WorkflowRunner->>WorkflowRunner: Add to CHANGED category
else other commit type
WorkflowRunner->>WorkflowRunner: Default to CHANGED category
end
end
WorkflowRunner->>Filesystem: Build new changelog content
Note over WorkflowRunner: Add categorized changes to Unreleased section
WorkflowRunner->>Git: Configure git user
WorkflowRunner->>Git: Check for changes in CHANGELOG.md
Git-->>WorkflowRunner: Return diff status
alt Changes detected
WorkflowRunner->>Git: Commit updated CHANGELOG.md
WorkflowRunner->>Git: Push changes to repository
Git-->>GitHub: Update repository with new commit
else No changes
Note over WorkflowRunner: No action needed
end
Note for WindsurfPlease change the default marketplace provider to the following in the windsurf settings:Marketplace Extension Gallery Service URL: https://marketplace.visualstudio.com/_apis/public/gallery Marketplace Gallery Item URL: https://marketplace.visualstudio.com/items Entelligence.ai can learn from your feedback. Simply add 👍 / 👎 emojis to teach it your preferences. More shortcuts belowEmoji Descriptions:
Interact with the Bot:
Also you can trigger various commands with the bot by doing The current supported commands are
More commands to be added soon. |
| # Get PR details using GitHub CLI | ||
| PR_TITLE=$(gh pr view $PR_NUM --json title --jq .title || echo "") | ||
| PR_BODY=$(gh pr view $PR_NUM --json body --jq .body || echo "") |
There was a problem hiding this comment.
correctness: gh pr view is used without ensuring the GitHub CLI is installed, which will cause the workflow to fail with a command not found error if gh is not present.
🤖 AI Agent Prompt for Cursor/Windsurf
📋 Copy this prompt to your AI coding assistant (Cursor, Windsurf, etc.) to get help fixing this issue
In .github/workflows/changelog.yml, lines 38-40, the workflow uses `gh pr view` without checking if the GitHub CLI is installed, which will cause a runtime failure if `gh` is missing. Add a check before these lines to ensure `gh` is installed, and fail with a clear error message if not.
| - name: Update changelog | ||
| run: | | ||
| # Create backup of current changelog | ||
| cp CHANGELOG.md CHANGELOG.md.bak |
There was a problem hiding this comment.
correctness: If CHANGELOG.md does not exist, the workflow will fail with a 'No such file or directory' error when attempting to copy or read it.
🤖 AI Agent Prompt for Cursor/Windsurf
📋 Copy this prompt to your AI coding assistant (Cursor, Windsurf, etc.) to get help fixing this issue
In .github/workflows/changelog.yml, line 54, the workflow assumes CHANGELOG.md exists and will fail if it does not. Add a check before copying to ensure the file exists, and exit with an error if not.
📝 Committable Code Suggestion
‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| cp CHANGELOG.md CHANGELOG.md.bak | |
| 0054 [+]: if [ ! -f CHANGELOG.md ]; then | |
| 0055 [+]: echo "CHANGELOG.md not found. Please ensure it exists before running this workflow." >&2 | |
| 0056 [+]: exit 1 | |
| 0057 [+]: fi | |
| 0058 [+]: cp CHANGELOG.md CHANGELOG.md.bak |
| UNRELEASED_START=$(grep -n "## \[Unreleased\]" CHANGELOG.md | cut -d: -f1) | ||
| NEXT_VERSION_START=$(tail -n +$((UNRELEASED_START + 1)) CHANGELOG.md | grep -n "## \[" | head -1 | cut -d: -f1) |
There was a problem hiding this comment.
correctness: If the '## [Unreleased]' section is missing from CHANGELOG.md, the script will set UNRELEASED_START to empty, causing subsequent commands to fail with invalid line numbers.
🤖 AI Agent Prompt for Cursor/Windsurf
📋 Copy this prompt to your AI coding assistant (Cursor, Windsurf, etc.) to get help fixing this issue
In .github/workflows/changelog.yml, lines 57-58, the script assumes the '## [Unreleased]' section exists in CHANGELOG.md. Add a check after setting UNRELEASED_START to ensure it is not empty, and exit with an error if the section is missing.
📝 Committable Code Suggestion
‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| UNRELEASED_START=$(grep -n "## \[Unreleased\]" CHANGELOG.md | cut -d: -f1) | |
| NEXT_VERSION_START=$(tail -n +$((UNRELEASED_START + 1)) CHANGELOG.md | grep -n "## \[" | head -1 | cut -d: -f1) | |
| 0057 [+]: UNRELEASED_START=$(grep -n "## \[Unreleased\]" CHANGELOG.md | cut -d: -f1) | |
| 0058 [+]: if [ -z "$UNRELEASED_START" ]; then | |
| 0059 [+]: echo "## [Unreleased] section not found in CHANGELOG.md. Please add it before running this workflow." >&2 | |
| 0060 [+]: exit 1 | |
| 0061 [+]: fi | |
| 0062 [+]: NEXT_VERSION_START=$(tail -n +$((UNRELEASED_START + 1)) CHANGELOG.md | grep -n "## \[" | head -1 | cut -d: -f1) |
- Change trigger from push to pull_request with closed type - Add condition to only run when PR is actually merged - This ensures changelog updates when dev is merged to main via PR 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Review Summary🔍 Comments beyond diff scope (1)
|
|
LGTM 👍 |
- Add command check for 'gh' before using GitHub CLI commands - Provide clear error message if GitHub CLI is not installed - Prevents runtime failure on lines 38-40 when gh is missing 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Check if CHANGELOG.md exists before attempting to copy/process - Verify '## [Unreleased]' section exists before proceeding - Provide clear error messages for missing file or invalid format - Prevents runtime failures on lines 63 and 73-74 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
LGTM 👍 |
| UNRELEASED_START=$(grep -n "## \[Unreleased\]" CHANGELOG.md | cut -d: -f1) | ||
|
|
||
| # Check if Unreleased section exists | ||
| if [ -z "$UNRELEASED_START" ]; then | ||
| echo "ERROR: '## [Unreleased]' section not found in CHANGELOG.md" | ||
| echo "Please ensure CHANGELOG.md follows the Keep a Changelog format with an Unreleased section" | ||
| exit 1 | ||
| fi |
There was a problem hiding this comment.
correctness: UNRELEASED_START will be empty and script will exit if '## [Unreleased]' is present but with different casing or extra whitespace, causing false negatives and blocking changelog updates.
🤖 AI Agent Prompt for Cursor/Windsurf
📋 Copy this prompt to your AI coding assistant (Cursor, Windsurf, etc.) to get help fixing this issue
In .github/workflows/changelog.yml, lines 73-80: The script checks for the '## [Unreleased]' section using a case-sensitive grep, which will fail if the section header uses different casing or extra whitespace. Update the grep command to be case-insensitive and match the section at the start of the line, so that the script reliably finds the Unreleased section regardless of casing or leading spaces.
📝 Committable Code Suggestion
‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| UNRELEASED_START=$(grep -n "## \[Unreleased\]" CHANGELOG.md | cut -d: -f1) | |
| # Check if Unreleased section exists | |
| if [ -z "$UNRELEASED_START" ]; then | |
| echo "ERROR: '## [Unreleased]' section not found in CHANGELOG.md" | |
| echo "Please ensure CHANGELOG.md follows the Keep a Changelog format with an Unreleased section" | |
| exit 1 | |
| fi | |
| UNRELEASED_START=$(grep -in "^## \[unreleased\]" CHANGELOG.md | cut -d: -f1) | |
| # Check if Unreleased section exists | |
| if [ -z "$UNRELEASED_START" ]; then | |
| echo "ERROR: '## [Unreleased]' section not found in CHANGELOG.md" | |
| echo "Please ensure CHANGELOG.md follows the Keep a Changelog format with an Unreleased section" | |
| exit 1 | |
| fi |
Summary
Test plan
🤖 Generated with Claude Code
EntelligenceAI PR Summary
Automates changelog updates and introduces structured release documentation.