gizra / robo-release-notes
A Robo task for generating release notes from GitHub PRs and issues
Requires
- php: >=8.3
- ext-curl: *
- ext-json: *
- consolidation/robo: ^3.0|^4.0|^5.0
Requires (Dev)
- phpunit/phpunit: ^9.0|^10.0
- squizlabs/php_codesniffer: ^3.6
This package is not auto-updated.
Last update: 2025-06-26 11:28:13 UTC
README
A Robo task for generating comprehensive release notes from GitHub PRs and issues.
Features
- Automatic PR Detection: Extracts pull request numbers from git commit messages using multiple merge strategies
- GitHub API Integration: Fetches detailed information about PRs and their associated issues
- Smart Grouping: Groups pull requests by their related issues for better organization
- Contributor Tracking: Automatically tracks contributors from both PR authors and issue reporters
- Code Statistics: Provides statistics on lines changed and files modified
- Flexible Tag Comparison: Compare from any tag or automatically use the latest tag
- Rate Limiting: Respects GitHub API rate limits with intelligent batching
Installation
Install via Composer:
composer require gizra/robo-release-notes
Usage
Basic Setup
- Include the trait in your RoboFile.php:
<?php use Gizra\RoboReleaseNotes\ReleaseNotesTasks; class RoboFile extends \Robo\Tasks { use ReleaseNotesTasks; }
- Set up environment variables:
export GITHUB_ACCESS_TOKEN="your_github_token" export GITHUB_USERNAME="your_github_username"
Command Usage
Generate release notes from the latest tag:
robo generate:release-notes
Generate release notes from a specific tag:
robo generate:release-notes v1.2.0
Environment Variables
Variable | Description | Required |
---|---|---|
GITHUB_ACCESS_TOKEN |
GitHub personal access token with repo access | Yes |
GITHUB_USERNAME |
Your GitHub username | Yes |
To create a GitHub personal access token:
- Go to GitHub Settings → Developer settings → Personal access tokens
- Generate a new token with
repo
scope - Copy the token and set it as an environment variable
Sample Output
## Changelog - Implement user authentication system (#123) - Add login functionality (#145) - Add password reset feature (#146) - Implement session management (#147) - Fix payment processing bugs (#124) - Resolve credit card validation issues (#148) ### Other Changes - Update documentation (#149) - Refactor utility functions (#150) ## Contributors - @alice (5) - @bob (3) - @charlie (2) ## Code Statistics - Lines added: 1,234 - Lines deleted: 567 - Files changed: 23
How It Works
- Git Analysis: Scans git commits between the specified tag and HEAD
- PR Extraction: Uses regex patterns to extract PR numbers from commit messages
- GitHub API Calls: Fetches detailed PR and issue data from GitHub
- Issue Linking: Automatically links PRs to their associated issues using:
- Closing keywords (fixes, closes, resolves)
- Issue references in PR titles and descriptions
- Issue numbers in branch names
- Data Aggregation: Combines all data into a structured release notes format
Testing
Run the test suite:
composer test
Run code style checks:
composer cs
Fix code style issues:
composer cbf
Requirements
- PHP 7.4 or higher
- Robo 3.0 or 4.0
- cURL extension
- JSON extension
- Git repository with GitHub remote
- GitHub API access
Advanced Configuration
Custom GitHub API Endpoint
For GitHub Enterprise users, you can extend the ReleaseNotesGenerator
class and override the githubApiGet
method to use a custom API endpoint.
Custom Output Format
You can extend the ReleaseNotesGenerator
class and override the displayReleaseNotes
method to customize the output format.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
Changelog
See CHANGELOG.md for a complete list of changes.