Automatically generate clean, categorized release notes from merged PRs and commits.
- Automatic tag detection from
git pushevents - Merged PR collection between two tags with label-based categorization
- Commit-based fallback when PRs are unavailable
- Hybrid mode combining PRs and direct commits
- Customizable category mappings via JSON config
- Markdown-formatted changelog ready for GitHub Releases
- Ensure your repository uses Git tags for versioning (e.g.,
v1.0.0,v1.1.0). - Add the workflow file to
.github/workflows/in your repository. - The action uses
${{ secrets.GITHUB_TOKEN }}which is automatically provided by GitHub Actions.
name: Release Notes
on:
push:
tags:
- "v*"
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate Release Notes
id: notes
uses: nayandas69/smart-release-notes-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
body: ${{ steps.notes.outputs.changelog }}- name: Generate Release Notes
id: notes
uses: nayandas69/smart-release-notes-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
from_tag: v1.0.0
to_tag: v2.0.0
mode: HYBRID
config_file: .github/release-config.json| Input | Required | Default | Description |
|---|---|---|---|
token |
Yes | - | GitHub token for API access. |
from_tag |
No | Auto | Starting tag. Defaults to the previous tag. |
to_tag |
No | Auto | Ending tag. Defaults to the tag from the push event. |
mode |
No | HYBRID |
Data source: PR, COMMIT, or HYBRID. |
config_file |
No | - | Path to a JSON config file for custom category mappings. |
| Output | Description |
|---|---|
changelog |
Generated release notes in Markdown format. |
from_tag |
The resolved starting tag used for generation. |
to_tag |
The resolved ending tag used for generation. |
Create a JSON file (e.g., .github/release-config.json) to customize how PRs are categorized:
{
"categories": [
{ "title": "Breaking Changes", "labels": ["breaking", "breaking-change"] },
{ "title": "New Features", "labels": ["feature", "enhancement"] },
{ "title": "Bug Fixes", "labels": ["bug", "bugfix", "fix"] },
{ "title": "Documentation", "labels": ["documentation", "docs"] },
{ "title": "Maintenance", "labels": ["chore", "maintenance", "refactor"] },
{ "title": "Dependencies", "labels": ["dependencies", "deps"] }
],
"uncategorizedTitle": "Other Changes"
}PRs are matched to the first category whose labels intersect with the PR's labels. Unmatched PRs appear under the uncategorizedTitle section.
- Node.js 20+
- pnpm (or npm/yarn)
git clone https://github.com/nayandas69/smart-release-notes-action.git
cd smart-release-notes-action
pnpm installpnpm buildThis compiles TypeScript and bundles everything into dist/index.js using @vercel/ncc.
pnpm testpnpm typecheckpnpm formatpnpm format:checkContributions are welcome. To get started:
- Fork the repository.
- Create a feature branch:
git checkout -b feat/my-feature. - Make your changes and add tests.
- Run
pnpm test,pnpm buildandpnpm format:checkto verify. - Submit a pull request.
Please use descriptive PR titles and add appropriate labels for automatic categorization.
This project is licensed under the MIT License.