changelogithub-llm
v1.0.22
Published
Generate changelog for GitHub.
Maintainers
Readme
changelogithub
Generate changelog for GitHub releases from Conventional Commits, powered by changelogen.
Features
- Support exclamation mark as breaking change, e.g.
chore!: drop node v10 - Grouped scope in changelog
- Create the release note, or update the existing one
- List contributors
- 🤖 AI-powered release summaries - Generate intelligent summaries using LLM
- Support squash commit parsing
Usage
In GitHub Actions:
# .github/workflows/release.yml
name: Release
permissions:
contents: write
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set node
uses: actions/setup-node@v4
with:
registry-url: https://registry.npmjs.org/
node-version: lts/*
- run: npx changelogithub # or [email protected] to ensure a stable result
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}It will be trigged whenever you push a tag to GitHub that starts with v.
Configuration
You can configure the behavior by creating a changelog.config.{json,ts,js,mjs,cjs} file or providing options inline.
For LLM-powered summaries, you can configure the AI model and prompt:
export default {
enableLLMSummary: true,
llm: {
apiUrl: 'https://api.openai.com/v1/chat/completions',
apiKey: 'your-api-key',
model: 'gpt-3.5-turbo',
maxTokens: 1000,
// Option 1: Use a static prompt
prompt: 'Your custom prompt here...',
// Option 2: Fetch prompt from URL (takes priority over prompt)
promptUrl: 'https://raw.githubusercontent.com/your-org/prompts/main/changelog-prompt.txt',
maxDiffLines: 500
}
}Online Prompt Configuration
You can store your prompt templates online and fetch them dynamically:
GitHub Raw Files: Store prompts in your repository
promptUrl: 'https://raw.githubusercontent.com/your-org/prompts/main/changelog-prompt.txt'CDN or Web Server: Host prompts on any accessible URL
promptUrl: 'https://cdn.your-domain.com/prompts/changelog-prompt.txt'Fallback Mechanism: If the URL fails, it will fall back to the
promptconfig or default prompt
Benefits of online prompts:
- ✅ Centralized prompt management
- ✅ Easy updates without code changes
- ✅ Team collaboration on prompt engineering
- ✅ Version control for prompts
- ✅ Automatic fallback to local prompts
🤖 AI-Powered Release Summaries
This tool now supports AI-powered release summaries that analyze your commits and generate intelligent descriptions of your release. This feature uses LLM APIs to understand code changes and provide meaningful summaries in your preferred language.
Setup
- Enable the feature in your config:
// changelogithub.config.js
export default {
enableLLMSummary: true,
llm: {
apiKey: process.env.LLM_API_KEY, // Your LLM API key
model: 'gpt-3.5-turbo', // Model to use
apiUrl: 'https://api.openai.com/v1/chat/completions' // API endpoint
}
}- Set your API key as an environment variable:
export LLM_API_KEY="your-openai-api-key"
# or
export LLM_API_KEY="your-custom-llm-api-key"- Run with LLM enabled:
npx changelogithub --enable-llm-summary
# or if you have the API key in environment
npx changelogithub --enable-llm-summary --llm-api-key your-api-keySupported LLM Providers
- OpenAI: GPT-3.5, GPT-4, etc.
- Custom APIs: Any OpenAI-compatible API endpoint
- Local models: Any local LLM service with OpenAI-compatible interface
Configuration Options
{
enableLLMSummary: true,
llm: {
apiUrl: 'https://api.openai.com/v1/chat/completions', // API endpoint
apiKey: 'your-api-key', // API key
model: 'gpt-3.5-turbo', // Model name
maxTokens: 1000, // Max response tokens
maxDiffLines: 500, // Max diff lines per commit
prompt: 'Custom prompt...' // Custom prompt template
}
}CLI Options
--enable-llm-summary # Enable AI summary generation
--llm-api-key <key> # LLM API key
--llm-model <model> # Model to use (default: gpt-3.5-turbo)
--llm-api-url <url> # Custom API URLExample Output
When enabled, the generated changelog will include an AI summary at the top:
## 🤖 AI Generated Release Summary
### 🚀 主要更新
这个版本引入了多项重要功能和改进:
### 新功能
- 添加了 AI 驱动的 release 总结功能,可以自动分析 commit 和代码变更
- 支持 squash commit 的解析,提高了 changelog 的准确性
- 新增多个 CLI 选项用于配置 LLM 功能
### 改进
- 优化了 commit 解析逻辑,提升了处理复杂提交历史的能力
- 改进了错误处理和日志输出
---
### 🚀 Features
- Add AI-powered release summary generation
- Support squash commit parsing
...Preview Locally
npx changelogithub --dryWhy?
I used to use conventional-github-releaser for almost all my projects. Until I found that it does NOT support using exclamation marks for breaking changes - hiding those important breaking changes in the changelog without the awareness from maintainers.
License
MIT License © 2022 Anthony Fu
