jwage/changelog-generator
Composer 安装命令:
composer require jwage/changelog-generator
包简介
Generate a markdown changelog document from a GitHub milestone.
关键字:
README 文档
README
This library will generate a changelog markdown document from a GitHub milestone. It is based off of weierophinney/changelog_generator.
Features
- Shows total issues, pull requests and contributors in a GitHub milestone
- Filter by GitHub labels
- Grouped by GitHub labels
- Write changelog to a file
- Multi-Project configuration
- Connects related pull requests and issues to reduce redundant lines in the changelog
- GitHub Enterprise Support
Installation
You can install with composer:
$ composer require jwage/changelog-generator
Or you can download the latest changelog-generator.phar file from the releases pages.
Example
Here is what an example changelog looks like. It was generated from the 0.0.3 milestone in GitHub for this project:
0.0.3
- Total issues resolved: 7
- Total pull requests resolved: 7
- Total contributors: 1
Enhancement
- 15: Look for changelog-generator-config.php file by default if no --confi… thanks to @jwage
- 13: Allow changelog configurations to be provided via a php config file. thanks to @jwage
- 12: Allow changelog to be filtered by label names. thanks to @jwage
- 11: Add total contributors to changelog. thanks to @jwage
- 9: Improve changelog totals to be split by issue and pull requests. thanks to @jwage
- 7: Link pull requests and issues together to improve the changelog format. thanks to @jwage
- 6: Allow changelog to be written to a file. thanks to @jwage
You can also look at the CHANGELOG.md file which is generated by this project.
Basic Usage
Generate a change log based on a GitHub milestone with the following command:
$ ./vendor/bin/changelog-generator generate --user=doctrine --repository=migrations --milestone=2.0
Write to File
Write the generated changelog to a file with the --file option. If you don't provide a value, it will be written
to the current working directory in a file named CHANGELOG.md:
$ ./vendor/bin/changelog-generator generate --user=doctrine --repository=migrations --milestone=2.0 --file
You can pass a value to --file to specify where the changelog file should be written:
$ ./vendor/bin/changelog-generator generate --user=doctrine --repository=migrations --milestone=2.0 --file=changelog.md
By default it will overwrite the file contents but you can pass the --append option to append the changelog to
the existing contents.
$ ./vendor/bin/changelog-generator generate --user=doctrine --repository=migrations --milestone=2.0 --file=changelog.md --append
If you want to prepend the changelog to an existing file, use the --prepend option:
$ ./vendor/bin/changelog-generator generate --user=doctrine --repository=migrations --milestone=2.0 --file=changelog.md --prepend
Connecting Issues & Pull Requests
To make the changelog easier to read, we try to connect pull requests to issues by looking for #{ISSUE_NUMBER} in the body
of the pull request. When the user of the issue and pull request are different github users, the changelog line will look like the following:
- 634: Fix namespace in bin/doctrine-migrations.php thanks to @Majkl578 and @jwage
Filtering by Labels
You can filter the changelog by label names using the --label option:
$ ./vendor/bin/changelog-generator generate --user=doctrine --repository=migrations --milestone=2.0 --label=Enhancement --label=Bug
Including Open Issues & Pull Requests
It can be convenient when preparing release notes for an upcoming release to include open issues and pull requests. For
this you can use the --include-open option:
$ ./vendor/bin/changelog-generator generate --user=doctrine --repository=migrations --milestone=2.0 --include-open
Configuration File
You can provide a PHP configuration file to the changelog generator if you don't want to provide the data manually each time.
Put the following contents in a file named config.php:
<?php declare(strict_types=1); use ChangelogGenerator\ChangelogConfig; return [ 'changelog-generator' => (new ChangelogConfig()) ->setUser('jwage') ->setRepository('changelog-generator') ->setMilestone('0.0.4') ->setLabels(['Enhancement', 'Bug']) ->setIncludeOpen(true) , 'another-project' => (new ChangelogConfig()) // ... , ];
Then you can use the configuration file like the following:
$ ./vendor/bin/changelog-generator generate --config=config.php
By default it will generate a changelog for the first changelog config in the array returned by the file. You can use the
--project option if you want to generate a changelog for a specific project in the config file:
$ ./vendor/bin/changelog-generator generate --config=config.php --project=another-project
By default if you name your config file changelog-generator-config.php, the changelog generator will look for that file
if no --config option is passed.
$ ./vendor/bin/changelog-generator generate
You can override options provided by the ChangelogConfig object from the command line by passing options to the
generate command:
$ ./vendor/bin/changelog-generator generate --include-open=0
GitHub Enterprise Support
You can configure the URL of your GitHub instance by using the rootGitHubUrl option. In your config.php you can
pass a 5th argument to ChangelogConfig that contains an array of options:
<?php declare(strict_types=1); use ChangelogGenerator\ChangelogConfig; return [ 'changelog-generator' => (new ChangelogConfig()) ->setUser('jwage') ->setRepository('changelog-generator') ->setMilestone('0.0.3') ->setLabels(['Enhancement', 'Bug'],) ->setOption('rootGitHubUrl', 'https://git.mycompany.com/api/v3') , ];
GitHub Authentication
By default it is not required to authenticate with GitHub to use this tool. But if you want higher rate limits or want to use it with private repositories then you will need to authenticate.
Personal Credentials
You can authenticate with your username and password or a personal access token
instead of your password using the ChangelogGenerator\GitHubUsernamePassword class:
<?php declare(strict_types=1); use ChangelogGenerator\ChangelogConfig; use ChangelogGenerator\GitHubUsernamePassword; return [ 'changelog-generator' => (new ChangelogConfig()) // ... ->setGitHubCredentials(new GitHubUsernamePassword('username', 'passwordOrToken')) , ];
OAuth Token
You can authenticate with an OAuth token as well using the ChangelogGenerator\GitHubOAuthToken class:
<?php declare(strict_types=1); use ChangelogGenerator\ChangelogConfig; use ChangelogGenerator\GitHubOAuthToken; return [ 'changelog-generator' => (new ChangelogConfig()) // ... ->setGitHubCredentials(new GitHubOAuthToken('the oauth token')) , ];
jwage/changelog-generator 适用场景与选型建议
jwage/changelog-generator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 74.75k 次下载、GitHub Stars 达 103, 最近一次更新时间为 2018 年 07 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「github」 「changelog」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jwage/changelog-generator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jwage/changelog-generator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jwage/changelog-generator 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Handles basic OAuth/OAuth2 authentication along with classes for common services
MediaWiki extension that allows embedding external content, specified by URL, into your wiki pages
A Deployment/Change Log Schedule and Notes system for SilverStripe sites
Package to enable change logs to be parsed
A Filament plugin that displays a beautiful version changelog modal with an always-accessible 'What's New' button.
Automated release management for Laravel packages with Conventional Commits support
统计信息
- 总下载量: 74.75k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 103
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-07-26