- 📝 Automatically fetches merged pull requests from GitHub
- 🏷️ Categorizes pull requests based on labels (Features, Bug Fixes, Documentation, etc.)
- 📄 Generates formatted markdown output
- ⚙️ Customizable categorization logic
- 🔧 Simple configuration using environment variables
- 📧 Email notification support with customizable templates
- 📄 Attachments of generated release notes (PDF and Markdown)
- 🔄 Support for generating release notes between any two versions
- 🎯 Flexible version specification via .env or command line
- Node.js (v12 or higher)
- GitHub Personal Access Token with
repo
scope - npm or yarn package manager
-
Clone the repository:
git clone <repository-url> cd github-release-notes-generator
-
Install dependencies:
npm install
-
Copy
.env-example
to.env
and configure your environment variables:cp .env-example .env
Create or modify your .env
file with the following required settings:
# GitHub Configuration (Required)
GITHUB_OWNER=your-username-or-org
GITHUB_REPO=your-repository-name
GITHUB_TOKEN=your-github-personal-access-token
# Release Versions (Optional)
END_VERSION=v2.0.0
START_VERSION=v1.0.0 # Optional - if not specified, will use previous release
# Email Settings (Optional - for email notifications)
EMAIL_FROM=[email protected]
EMAIL_TO=[email protected]
EMAIL_CC=[email protected]
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_SECURE=true
SMTP_USER=your-smtp-username
SMTP_PASS=your-smtp-password
To get a GitHub Personal Access Token:
- Go to GitHub Settings > Developer settings > Personal access tokens
- Click "Generate new token"
- Select the
repo
scope - Copy the generated token and add it to your
.env
file
You can specify release versions in three ways:
-
Using Command Line Arguments (Highest Priority):
# Generate notes between two specific versions node releaseNoteGenerator.js v2.0.0 v1.0.0 # Generate notes from previous release to v2.0.0 node releaseNoteGenerator.js v2.0.0
-
Using Environment Variables in
.env
file:END_VERSION=v2.0.0 START_VERSION=v1.0.0 # Optional
Then run:
node releaseNoteGenerator.js
-
Mix and Match:
- Set default versions in
.env
- Override when needed via command line
# Override both versions node releaseNoteGenerator.js v2.1.0 v2.0.0 # Override only end version (will use START_VERSION from .env) node releaseNoteGenerator.js v2.1.0
- Set default versions in
The generator will create two files in the output
directory:
release-notes-{version}.md
- Markdown formatrelease-notes-{version}.pdf
- PDF format with styling
If email settings are configured in .env
, you can send release notes via email:
const generator = new ReleaseNoteGenerator(owner, repo, token);
await generator.generateReleaseNotes(endVersion, startVersion, {
generateEmail: true,
sendEmail: true,
});
Pull requests are automatically categorized based on their labels:
- Features: PRs with 'feature' or 'enhancement' labels
- Bug Fixes: PRs with 'bug' or 'fix' labels
- Documentation: PRs with 'documentation' label
- Other: PRs without any of the above labels
- Add your logo at
./assets/logo.png
- Add header background at
./assets/header-bg.png
- Customize email template in
./Template/email-template.eml
- Modify categorization logic in
categorizePullRequests()
method
This project is licensed under the MIT License - see the LICENSE file for details.