Skip to content

📓 A script which generates a changelog based on merged pull requests between references.

License

Notifications You must be signed in to change notification settings

the-tool/github-changelog

 
 

Repository files navigation

README

Build Status Code Climate Test Coverage Issue Count

CLI Tool

Global installation

Install globally:

$ composer global require localheinz/github-changelog

Create your changelogs anywhere:

$ github-changelog generate localheinz github-changelog 0.1.1 0.1.2

Enjoy the changelog:

- Fix: Catch exceptions in command (#37)
- Fix: Request 250 instead of 30 commits (#38)

Local installation

Install locally:

$ composer require --dev --sort-packages localheinz/github-changelog

Create your changelog from within in your project:

$ vendor/bin/github-changelog generate localheinz github-changelog ae63248 master

Enjoy the changelog:

- Enhancement: Create ChangeLog command (#31)
- Fix: Assert exit code is set to 0 (#32)
- Enhancement: Add console application (#33)
- Fix: Readme (#34)
- Fix: Autoloading for console script (#35)
- Fix: Version foo with rebasing and whatnot (#36)
- Fix: Catch exceptions in command (#37)
- Fix: Request 250 instead of 30 commits (#38)

Userland Code

Install locally:

$ composer require --sort-packages localheinz/github-changelog

Retrieve pull requests between references in your application:

<?php

require 'vendor/autoload.php';

use Github\Client;
use Github\HttpClient\CachedHttpClient;
use Localheinz\GitHub\ChangeLog\Repository;
use Localheinz\GitHub\ChangeLog\Resource;

$client = new Client(new CachedHttpClient());
$client->authenticate(
    'your-token-here',
    Client::AUTH_HTTP_TOKEN
);

$repository = new Repository\PullRequestRepository(
    $client->pullRequests(),
    new Repository\CommitRepository($client->repositories()->commits())
);

/* @var Resource\RangeInterface $range */
$range = $repository->items(
    'localheinz',
    'github-changelog',
    '0.1.1',
    '0.1.2'
);

$pullRequests = $range->pullRequests();

array_walk($pullRequests, function (Resource\PullRequestInterface $pullRequest) {
    echo sprintf(
        '- %s (#%s)' . PHP_EOL,
        $pullRequest->title(),
        $pullRequest->id()
    );
});

Enjoy the changelog:

- Fix: Catch exceptions in command (#37)
- Fix: Request 250 instead of 30 commits (#38)

Hints

💡 You can use anything for a reference, e.g., a tag, a branch, a commit!

Contributing

Please have a look at CONTRIBUTING.md.

License

This package is licensed using the MIT License.

About

📓 A script which generates a changelog based on merged pull requests between references.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 99.8%
  • Makefile 0.2%