localheinz / github-changelog
Provides a console command that generates a changelog based on titles of pull requests merged between specified references.
Fund package maintenance!
localheinz
Installs: 142
Dependents: 0
Suggesters: 0
Security: 0
Stars: 48
Watchers: 3
Forks: 7
Open Issues: 18
Requires
- php: ^7.2
- knplabs/github-api: ^2.12.1
- php-http/guzzle6-adapter: ^1.1.1
- symfony/cache: ^4.3.8
- symfony/console: ^4.3.8
- symfony/stopwatch: ^4.4.1
Requires (Dev)
- ergebnis/php-cs-fixer-config: ~1.1.0
- ergebnis/phpstan-rules: ~0.14.0
- ergebnis/test-util: ~0.9.0
- infection/infection: ~0.13.6
- jangregor/phpstan-prophecy: ~0.4.2
- localheinz/composer-normalize: ^1.3.1
- phpstan/extension-installer: ^1.0.3
- phpstan/phpstan: ~0.11.19
- phpstan/phpstan-deprecation-rules: ~0.11.2
- phpstan/phpstan-strict-rules: ~0.11.1
- phpunit/phpunit: ^8.4.3
- dev-main
- 0.7.1
- 0.7.0
- 0.6.1
- 0.6.0
- 0.5.2
- 0.5.1
- 0.5.0
- 0.4.0
- 0.3.0
- 0.2.1
- 0.2.0
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- dev-dependabot/github_actions/stefanzweifel/git-auto-commit-action-4.13.1
- dev-dependabot/composer/vimeo/psalm-4.18.1
- dev-dependabot/github_actions/actions/github-script-5.1.0
- dev-dependabot/composer/ergebnis/test-util-1.6.0
- dev-dependabot/composer/symfony/cache-5.4.2
- dev-dependabot/composer/symfony/console-5.4.2
- dev-dependabot/github_actions/actions/stale-4.1.0
- dev-dependabot/composer/symfony/stopwatch-5.4.0
- dev-dependabot/github_actions/shivammathur/setup-php-2.16.0
- dev-dependabot/github_actions/actions/cache-2.1.7
- dev-dependabot/github_actions/actions/checkout-2.4.0
- dev-dependabot/composer/phpstan/phpstan-0.12.99
- dev-dependabot/composer/phpunit/phpunit-9.5.9
- dev-dependabot/github_actions/ibiqlik/action-yamllint-3.0.1
- dev-dependabot/composer/ergebnis/php-cs-fixer-config-2.14.0
- dev-dependabot/composer/infection/infection-0.22.0
- dev-dependabot/composer/knplabs/github-api-2.20.0
This package is auto-updated.
Last update: 2022-01-24 09:40:07 UTC
README
Provides a script that generates a changelog based on titles of pull requests merged between specified references.
Is this the right tool for me?
Probably not. There are a range of other tools that probably do a better job.
Take a look at
- https://packagist.org/?q=changelog
- https://www.npmjs.com/search?q=changelog
- https://pypi.python.org/pypi?%3Aaction=search&term=changelog
Nonetheless, for me and my projects, it's the second best thing after manually keeping a changelog as suggested at http://keepachangelog.com.
When will it work for me?
My process | Will this tool work for me? |
---|---|
I need elaborate changelogs | No |
I push directly into the default branch | No |
No | |
No | |
Yes |
Why is this tool so limited?
All this tool does is this:
- it collects commits between references
- it matches commit messages against what is used by GitHub as a merge commit message
- it fetches the pull request title from the corresponding pull request
- it then uses all of the pull request titles to compile a list
CLI Tool
Global installation
Install globally:
$ composer global require ergebnis/github-changelog
Create your changelogs from within a Git repository:
$ git clone git@github.com:ergebnis/github-changelog.git
$ cd github-changelog
$ github-changelog generate 0.1.1 0.1.2
Create your changelogs from anywhere, specifying the repository using the --repository
option:
$ github-changelog generate --repository ergebnis/github-changelog 0.1.1 0.1.2
Enjoy the changelog:
- Fix: Catch exceptions in command (#37), by @localheinz
- Fix: Request 250 instead of 30 commits (#38), by @localheinz
Local installation
Install locally:
$ composer require --dev ergebnis/github-changelog
Create your changelog from within in your project:
$ vendor/bin/github-changelog generate ergebnis/github-changelog ae63248 main
Enjoy the changelog:
- Enhancement: Create ChangeLog command (#31), by @localheinz
- Fix: Assert exit code is set to 0 (#32), by @localheinz
- Enhancement: Add console application (#33), by @localheinz
- Fix: Readme (#34), by @localheinz
- Fix: Autoloading for console script (#35), by @localheinz
- Fix: Version foo with rebasing and whatnot (#36), by @localheinz
- Fix: Catch exceptions in command (#37), by @localheinz
- Fix: Request 250 instead of 30 commits (#38), by @localheinz
Userland Code
Install locally:
$ composer require ergebnis/github-changelog
Retrieve pull requests between references in your application:
<?php require 'vendor/autoload.php'; use Github\Client; use Github\HttpClient\CachedHttpClient; use Ergebnis\GitHub\Changelog\Repository; use Ergebnis\GitHub\Changelog\Resource; $client = new Client(new CachedHttpClient()); $client->authenticate( 'your-token-here', Client::AUTH_HTTP_TOKEN ); $pullRequestRepository = new Repository\PullRequestRepository( $client->pullRequests(), new Repository\CommitRepository($client->repositories()->commits()) ); /* @var Resource\RangeInterface $range */ $range = $repository->items( Resource\Repository::fromString('ergebnis/github-changelog'), '0.1.1', '0.1.2' ); $pullRequests = $range->pullRequests(); array_walk($pullRequests, function (Resource\PullRequestInterface $pullRequest) { echo sprintf( '- %s (#%d), submitted by @%s' . PHP_EOL, $pullRequest->title(), $pullRequest->number(), $pullRequest->author()->login(), ); });
Enjoy the changelog:
- Fix: Catch exceptions in command (#37), submitted by @localheinz
- Fix: Request 250 instead of 30 commits (#38), submitted by @localheinz
Hints
💡 You can use anything for a reference, e.g., a tag, a branch, a commit!
Changelog
Please have a look at CHANGELOG.md
.
Contributing
Please have a look at CONTRIBUTING.md
.
Code of Conduct
Please have a look at CODE_OF_CONDUCT.md
.
License
This package is licensed using the MIT License.
Please have a look at LICENSE.md
.
Curious what I am building?
📬 Subscribe to my list, and I will occasionally send you an email to let you know what I am working on.