Skip to content
:octocat: Provides a command line tool that generates a changelog based on titles of pull requests merged between specified references.
PHP Makefile
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.dependabot
.github Enhancement: Synchronize with ergebnis/php-library-template Jan 19, 2020
src Enhancement: Synchronize with ergebnis/php-library-template Jan 19, 2020
test Enhancement: Synchronize with ergebnis/php-library-template Jan 19, 2020
.editorconfig Enhancement: Synchronize project tooling configuration with localhein… Apr 1, 2019
.gitattributes Enhancement: Synchronize with ergebnis/php-library-template Jan 4, 2020
.gitignore Enhancement: Synchronize project tooling configuration with localhein… Apr 1, 2019
.php_cs Enhancement: Synchronize with ergebnis/php-library-template Jan 19, 2020
CHANGELOG.md Fix: Remove inappropriate replace configuration Dec 15, 2019
LICENSE.md Enhancement: Synchronize with ergebnis/php-library-template Jan 19, 2020
Makefile Enhancement: Synchronize with ergebnis/php-library-template Jan 6, 2020
README.md Enhancement: Synchronize with ergebnis/php-library-template Jan 19, 2020
composer.json Build(deps-dev): Bump ergebnis/php-cs-fixer-config from 1.1.3 to 2.0.0 Jan 20, 2020
composer.lock Build(deps-dev): Bump ergebnis/php-cs-fixer-config from 1.1.3 to 2.0.0 Jan 20, 2020
github-changelog Enhancement: Update knplabs/github-api Oct 9, 2016
github-changelog.php Enhancement: Synchronize with ergebnis/php-library-template Jan 19, 2020
infection.json Enhancement: Store infection build files in .build/infection Mar 31, 2019
phpstan-baseline.neon Fix: Run 'make static-code-analysis-baseline' Dec 23, 2019
phpstan.neon Fix: Do not bother checking iterable value type Dec 23, 2019
psalm-baseline.xml Enhancement: Synchronize with ergebnis/php-library-template Jan 4, 2020
psalm.xml Enhancement: Synchronize with ergebnis/php-library-template Jan 4, 2020

README.md

github-changelog

Continuous Deployment Continuous Integration

Code Coverage Type Coverage

Latest Stable Version Total Downloads

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

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 to master No
Rebase and merge No
Squash and merge No
Merge pull request 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 master

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.

You can’t perform that action at this time.