Skip to main content

Automatically generate a changelog using AI

Project description

GPTChangelog

Automatically generate detailed, well-structured changelogs from your git commit history using OpenAI's GPT models.

Features

  • 🤖 AI-powered changelog generation from git commit messages
  • 🔄 Automatic semantic versioning determination
  • 🏷️ Support for conventional commits
  • ✨ Beautiful formatting with Markdown
  • 🧠 Smart categorization of changes
  • 🖋️ Interactive editing mode
  • 📋 Customizable templates
  • 🛠️ Project-specific or global configuration

Installation

pip install gptchangelog

Quick Start

  1. Initialize the configuration (only needed once):
gptchangelog config init
  1. Generate a changelog from your latest tag:
gptchangelog generate

The tool will:

  • Fetch commit messages since your latest tag
  • Process and categorize them using OpenAI
  • Determine the next version number based on semantic versioning
  • Generate a well-structured changelog
  • Prepend it to your CHANGELOG.md file

Command Line Usage

gptchangelog generate [OPTIONS]

Options

  • --since <ref>: Starting point (commit hash, tag, or reference)
  • --to <ref>: Ending point (commit hash, tag, or reference, defaults to HEAD)
  • --output <file>, -o <file>: Output file (defaults to CHANGELOG.md)
  • --current-version <version>: Override the current version
  • --dry-run: Generate changelog but don't save it
  • --interactive, -i: Review and edit before saving

Examples

Generate changelog since the latest tag:

gptchangelog generate

Generate changelog between two specific tags:

gptchangelog generate --since v1.0.0 --to v2.0.0

Generate changelog with interactive editing:

gptchangelog generate -i

Configuration

GPTChangelog supports both global and project-specific configuration:

  • Global: Stored in ~/.config/gptchangelog/config.ini
  • Project: Stored in ./.gptchangelog/config.ini

Managing Configuration

Show current configuration:

gptchangelog config show

Initialize configuration:

gptchangelog config init

Configuration Options

  • api_key: Your OpenAI API key
  • model: The OpenAI model to use (default: gpt-4o)
  • max_context_tokens: Maximum tokens to use in each API call (default: 80000)

Integrating with CI/CD

You can integrate GPTChangelog into your CI/CD pipeline to automatically generate changelogs for new releases:

# Example GitHub Actions workflow
name: Generate Changelog

on:
  push:
    tags:
      - 'v*'

jobs:
  changelog:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0  # Important to fetch all history

      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: '3.10'

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install gptchangelog

      - name: Generate changelog
        run: |
          echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" > .env
          gptchangelog generate --since $(git describe --tags --abbrev=0 --match "v*" HEAD^) --to ${{ github.ref_name }}

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gptchangelog-0.8.2.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gptchangelog-0.8.2-py3-none-any.whl (25.2 kB view details)

Uploaded Python 3

File details

Details for the file gptchangelog-0.8.2.tar.gz.

File metadata

  • Download URL: gptchangelog-0.8.2.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.11

File hashes

Hashes for gptchangelog-0.8.2.tar.gz
Algorithm Hash digest
SHA256 428522be807dd41b11c817a45dda15c33117d4d13e012157bc7a239fab389f01
MD5 0c5e57d6d9db8b5dbc1e075941c8718c
BLAKE2b-256 5ae4d448bd5bb005425cf4cdee6a027bfaf64e27b7ab07318be8439f757730b7

See more details on using hashes here.

File details

Details for the file gptchangelog-0.8.2-py3-none-any.whl.

File metadata

  • Download URL: gptchangelog-0.8.2-py3-none-any.whl
  • Upload date:
  • Size: 25.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.11

File hashes

Hashes for gptchangelog-0.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c9b1a6f0a9fc673ef6c3cd2bba4ddeacffef3e0bcf4636dc0077497be12515e4
MD5 db65faee08d38cbd6394815294b37fb1
BLAKE2b-256 3a45627cbda3240e7dc170ebb2128fb5f8e84921b6cdb06e2ef3e467a11e8809

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page