Skip to content

Conversation

pratik-mahalle
Copy link

@pratik-mahalle pratik-mahalle commented Sep 21, 2025

User description

Description of Changes

  • Introduced a new changelog_generator agent that automatically generates human-readable changelogs based on commits, PRs, and issues.

  • Added MCP server configuration for:

    • GitHub – fetch PRs/issues using GITHUB_PERSONAL_ACCESS_TOKEN.
    • Filesystem – write changelog to JSON/Markdown file.
  • Defined output schema with proper descriptions for:

    • success
    • changelog
    • commit_count
    • pr_count
    • issue_count
  • Updated documentation with setup instructions for GITHUB_PERSONAL_ACCESS_TOKEN and uvx installation.

Why This Change Is Needed

Manually creating release notes is repetitive and time-consuming.
This agent automates changelog generation for every sprint or release, making it:

  • Consistent – Always follows the same format.

  • Time-saving – No need to manually collect commit/PR/issue data.

  • Developer-friendly – Can be triggered via CLI:

    qodo changelog_generator --set repo=owner/repo --set since=v1.0.0

Testing Performed

  • Ran the agent locally with a sample repository.
  • Validated that MCP servers (filesystem, github) initialize correctly.
  • Generated a sample Markdown changelog and confirmed counts match repo history.

Additional Notes

This is a foundation for automating release notes.
Future improvements could include:

  • Automatic tagging & GitHub release creation.
  • Integration with JIRA for issue linking.
  • Auto-committing generated changelogs in CI/CD pipelines.

PR Type

Enhancement


Description

  • Add automated changelog generator agent for GitHub repositories

  • Include CI/CD integration examples for GitHub Actions and GitLab CI

  • Support conventional commits grouping and customizable output formats

  • Provide comprehensive documentation and configuration files


Diagram Walkthrough

flowchart LR
  A["GitHub Repository"] --> B["Qodo Agent"]
  B --> C["GitHub API"]
  B --> D["Generated CHANGELOG.md"]
  E["CI/CD Pipeline"] --> B
  F["Configuration Files"] --> B
Loading

File Walkthrough

Relevant files
Documentation
AGENTS.md
Repository guidelines and architecture documentation         

agents/changelog-generator/AGENTS.md

  • Add comprehensive repository guidelines and architecture documentation
  • Include project structure overview and technology stack details
  • Document common workflows and security considerations
  • Provide performance guidelines and external dependencies
+199/-0 
README.md
Main documentation and usage guide                                             

agents/changelog-generator/README.md

  • Add main documentation with features and usage examples
  • Include command-line arguments and configuration options
  • Provide sample output format and build validation instructions
  • Document prerequisites and installation steps
+111/-0 
Configuration changes
agent.toml
TOML agent configuration file                                                       

agents/changelog-generator/agent.toml

  • Define TOML configuration for changelog generator command
  • Configure GitHub and shell MCP servers with authentication
  • Specify command arguments and output schema
  • Set execution strategy and tool dependencies
+55/-0   
agent.yaml
YAML agent configuration file                                                       

agents/changelog-generator/agent.yaml

  • Define YAML configuration as alternative to TOML format
  • Mirror TOML configuration with identical functionality
  • Include MCP server setup and command definitions
  • Specify output schema and execution parameters
+78/-0   
github-actions.yml
GitHub Actions CI/CD integration                                                 

agents/changelog-generator/examples/ci-configs/github-actions.yml

  • Add GitHub Actions workflow for automated changelog generation
  • Include tag-based and manual workflow triggers
  • Configure Node.js setup and Qodo CLI installation
  • Implement automatic commit and push of generated changelog
+70/-0   
gitlab-ci.yml
GitLab CI/CD integration                                                                 

agents/changelog-generator/examples/ci-configs/gitlab-ci.yml

  • Add GitLab CI pipeline for changelog automation
  • Configure tag-based and scheduled pipeline triggers
  • Include Git configuration and automatic pushing
  • Set up Node.js environment and Qodo CLI installation
+36/-0   

Copy link
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 Security concerns

Credential leakage in CI push URLs:
The GitLab CI config pushes via an HTTPS URL embedding ${GITLAB_TOKEN}. Although common, this risks token exposure in logs or remote refs if echoed; prefer using CI-provided authenticated remotes/variables with masked outputs or GitLab-provided CI_JOB_TOKEN and deploy tokens. Additionally, ensure secrets are masked and that git output does not print the full URL.

⚡ Recommended focus areas for review

Possible Misconfiguration

The GitHub MCP server URL points to api.githubcopilot.com, which may be unintended for standard GitHub API access and could break data fetching; verify the correct MCP endpoint is used.

mcpServers = """
{
  "github": {
    "url": "https://api.githubcopilot.com/mcp/",
    "headers": {
      "Authorization": "Bearer ${GITHUB_PERSONAL_ACCESS_TOKEN}"
    }
  },
  "external_shell": {
    "command": "uvx",
    "args": ["mcp-shell-server"]
  }
}
"""
Token Handling

The workflow sets Authorization to use GITHUB_PERSONAL_ACCESS_TOKEN; ensure this aligns with CI usage where GITHUB_TOKEN is provided and confirm scopes and naming consistency across docs and pipelines.

mcpServers:
  github:
    url: "https://api.githubcopilot.com/mcp/"
    headers:
      Authorization: "Bearer ${GITHUB_PERSONAL_ACCESS_TOKEN}"
  external_shell:
    command: "uvx"
    args: ["mcp-shell-server"]
Range Resolution

When no previous tag exists, the workflow falls back to the last 14 days; confirm this default is acceptable and won’t omit important history for first releases or long gaps.

- name: Determine range
  id: range
  shell: bash
  run: |
    if [ -n "${{ github.event.inputs.since }}" ]; then
      echo "since=${{ github.event.inputs.since }}" >> $GITHUB_OUTPUT
    else
      prev=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || true)
      if [ -z "$prev" ]; then
        # Fallback to last 14 days
        echo "since=$(date -u -d '14 days ago' +%Y-%m-%d)" >> $GITHUB_OUTPUT
      else
        echo "since=$prev" >> $GITHUB_OUTPUT
      fi
    fi

Copy link
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
High-level
Use existing deterministic changelog tools

The suggestion recommends replacing the new LLM-based agent with an existing
deterministic tool like conventional-changelog-cli. This is because changelog
generation is a structured task where an LLM adds unnecessary complexity and
unreliability.

Examples:

agents/changelog-generator/agent.toml [6-12]
instructions = """
You are a changelog generator. Fetch PRs, issues, and commits from the specified repository and release tag or date range.
Group them into categories (Features, Fixes, Documentation, Chores, Others).
Generate a human-readable changelog in Markdown format that can be directly used in a RELEASE.md file.
Include PR numbers and authors.
Optionally group using Conventional Commit types (feat, fix, docs, chore, refactor). If disabled, fall back to heuristic grouping.
"""

Solution Walkthrough:

Before:

// agent.toml
[commands.changelog_generator]
description = "Generates release notes by analyzing commits, PRs, and issues..."
instructions = """
You are a changelog generator. Fetch PRs, issues, and commits...
Group them into categories (Features, Fixes, Documentation, Chores, Others).
Generate a human-readable changelog in Markdown format...
"""
tools = ["github", "filesystem", "external_shell"]
execution_strategy = "plan"

// ci-configs/github-actions.yml
- name: Generate CHANGELOG
  run: |
    qodo changelog_generator --set repo=${{ github.repository }} ...

After:

// (The agent.toml, agent.yaml, and other agent-specific files are removed)

// ci-configs/github-actions.yml
- name: Install Changelog Tool
  run: npm install -g conventional-changelog-cli

- name: Generate CHANGELOG
  run: conventional-changelog -p angular -i CHANGELOG.md -s

- name: Commit and push
  run: |
    git add CHANGELOG.md
    if ! git diff --staged --quiet; then
      git commit -m "docs(changelog): update changelog"
      git push
    fi
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a fundamental architectural flaw in using a non-deterministic LLM for a structured, rule-based task, for which mature and reliable deterministic tools already exist.

High
Possible issue
Prevent CI workflow recursive loops

To prevent a recursive CI loop, add [skip ci] to the commit message in the
Commit and push step of the GitHub Actions workflow.

agents/changelog-generator/examples/ci-configs/github-actions.yml [60-68]

 - name: Commit and push
   run: |
     git config user.name "github-actions[bot]"
     git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
     git add CHANGELOG.md
     if ! git diff --staged --quiet; then
-      git commit -m "docs(changelog): update for ${{ github.ref_name }}"
+      git commit -m "docs(changelog): update for ${{ github.ref_name }} [skip ci]"
       git push
     fi
  • Apply / Chat
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a critical bug in the CI workflow that would cause an infinite loop and provides the standard, correct fix.

High
Add missing GitHub authentication token

In the GitLab CI job, export the GITHUB_PERSONAL_ACCESS_TOKEN for API
authentication and add [skip ci] to the commit message to prevent CI loops.

agents/changelog-generator/examples/ci-configs/gitlab-ci.yml [4-34]

 generate_changelog:
   stage: docs
   image: node:20
   variables:
     GIT_STRATEGY: fetch
   script:
     - npm install -g @qodo/command
+    - export GITHUB_PERSONAL_ACCESS_TOKEN=$GITHUB_TOKEN
     - |
       PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || true)
       if [ -z "$PREV_TAG" ]; then
         SINCE=$(date -u -d '14 days ago' +%Y-%m-%d)
       else
         SINCE=$PREV_TAG
       fi
       qodo changelog_generator \
         --set repo=${CI_PROJECT_PATH} \
         --set since=${SINCE} \
         --set until=${CI_COMMIT_REF_NAME} \
         --set group_conventional=true \
         --set output_file=CHANGELOG.md
     - |
       git config user.name "gitlab-ci[bot]"
       git config user.email "gitlab-ci-bot@noreply"
       git add CHANGELOG.md
       if ! git diff --staged --quiet; then
-        git commit -m "docs(changelog): update for ${CI_COMMIT_REF_NAME}"
+        git commit -m "docs(changelog): update for ${CI_COMMIT_REF_NAME} [skip ci]"
         git push "https://oauth2:${GITLAB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git" HEAD:${CI_COMMIT_REF_NAME}
       fi
   only:
     - tags
     - schedules
  • Apply / Chat
Suggestion importance[1-10]: 9

__

Why: The suggestion identifies a critical missing authentication token that would cause the GitLab CI job to fail, and also proposes a valid improvement to prevent potential CI loops.

High
Fix incorrect changelog generation command

In the README.md usage example, change the git describe command to git describe
--tags --abbrev=0 HEAD^ to correctly find the previous tag and generate a
non-empty changelog.

agents/changelog-generator/README.md [69-73]

 Generate changelog since previous tag to HEAD and group by Conventional Commits:

-LAST_TAG=$(git describe --tags --abbrev=0)
+LAST_TAG=$(git describe --tags --abbrev=0 HEAD^)
qodo changelog_generator --set repo=owner/repo --set since=$LAST_TAG --set group_conventional=true

  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies a logical flaw in the documentation's example command that would lead to an empty changelog, and provides a correct command.

Medium
  • More

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant