symplify/changelog-linker

此包已被弃用且不再维护。作者建议使用ergebnis/github-changelog包。

生成具有链接到PRs、版本和用户的美丽CHANGELOG.md,这些用户按添加/更改/修复/删除分类分组。

v9.2.6 2021-03-08 21:02 UTC

This package is auto-updated.

Last update: 2021-03-23 12:57:20 UTC


README

此包已弃用。您想接管它或寻找替代品? 查看问题


Downloads

将您的CHANGELOG.md从机器可读文本转换为让每个程序员都感到满意的富文本。

安装

composer require symplify/changelog-linker --dev

用法

使用配置创建changelog-linker.php

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\ChangelogLinker\ValueObject\Option;

return static function (ContainerConfigurator $containerConfigurator): void {
    $parameters = $containerConfigurator->parameters();
    // this parameter is detected from "git origin", but you can change it
    $parameters->set(Option::REPOSITORY_URL, 'https://github.com/symplify/symplify');
};

配置在根目录中自动发现或在--config选项中。

A. 导出合并

vendor/bin/changelog-linker dump-merges

写入或试运行?

--dry-run选项将结果打印到输出。如果没有这个选项,程序将在CHANGELOG.md中查找<!-- changelog-linker -->并将其替换为内容。

它找到CHANGELOG.md中的最后一个#ID,然后通过API在GitHub上查找并按良好格式导出自最后一个#ID以来的所有已合并PR。如果您想自己指定最小PR ID,请使用此选项

vendor/bin/changelog-linker dump-merges --since-id 125

但这会混合所有内容。不太好看

## Unreleased

- [#868] [ChangelogLinker] Add ChangeTree to manage merge messages
- [#867] [ChangelogLinker] Change Worker registration from implicit to explicit
- [#865] Improve Code Complexity
- [#864] [MonorepoBuilder] improve coverage

如果我们有添加更改...所有标准分类怎么办?

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\ChangelogLinker\ValueObject\ChangelogFormat;
use Symplify\ChangelogLinker\ValueObject\Option;

return static function (ContainerConfigurator $containerConfigurator): void {
    $parameters = $containerConfigurator->parameters();
    $parameters->set(Option::CHANGELOG_FORMAT, ChangelogFormat::CATEGORIES_ONLY);
};
vendor/bin/changelog-linker dump-merges

## Unreleased

### Added

- [#828] [ChangelogLinker] Add Unreleased to last tagged version feature
- [#840] [ChangelogLinker] Add LinkifyWorker

很好,现在所有内容都整齐地分组了。

(想知道我们是如何检测分类的吗? 跟随我)

您可以使用以下4个包/分类选项

Symplify\ChangelogLinker\ValueObject\ChangelogFormat::PACKAGES_THEN_CATEGORIES;
Symplify\ChangelogLinker\ValueObject\ChangelogFormat::CATEGORIES_THEN_PACKAGES;
Symplify\ChangelogLinker\ValueObject\ChangelogFormat::CATEGORIES_ONLY;
Symplify\ChangelogLinker\ValueObject\ChangelogFormat::PACKAGES_ONLY;

基础分支

您想只导出合并到特定分支的pull请求吗?只需使用base-branch选项

vendor/bin/changelog-linker dump-merges --base-branch=7.3

当您支持您的项目的多个版本时,这非常方便。

GitHub API过载?

如果您超过API速率限制并被拒绝,请创建新的GitHub令牌并通过GITHUB_TOKEN环境变量运行它。

GITHUB_TOKEN super-secret-token vendor/bin/changelog-linker dump-merges

B. 装饰CHANGELOG.md

vendor/bin/changelog-linker link

1. 链接PR和问题

 ### Added

-- #123 Cool new without detailed description wanting me to see PR, [closes #234]
+- [#123] Cool new without detailed description wanting me to see PR, [closes [#234]]
+
+[#123]: https://github.com/symplify/symplify/pull/123
+[#234]: https://github.com/symplify/symplify/pull/234

2. 将版本链接到差异

-## v2.0.0 - 2017-12-31
+## [v2.0.0] - 2017-12-31

 - ...

 ## v1.5.0 - 2017-06-30
+
+[v2.0.0]: https://github.com/symplify/symplify/compare/v1.5.0...v2.0.0

3. 我能感谢我的贡献者吗?

当然可以!给你的贡献者应得的认可

 ### [v2.0.0] - 2017-12-31

-- ... thanks @SpacePossum for help
+- ... thanks [@SpacePossum] for help
+
+[@SpacePossum]: https://github.com/SpacePossum

你可以排除核心维护者,以给外部贡献者更多的认可

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\ChangelogLinker\ValueObject\Option;

return static function (ContainerConfigurator $containerConfigurator): void {
    $parameters = $containerConfigurator->parameters();
    // this parameter is detected from "git origin", but you can change it
    $parameters->set(Option::AUTHORS_TO_IGNORE, ['TomasVotruba']);
};

4. 如何链接特定的单词?

在Symplify中,我需要每个 EasyCodingStandard 单词都链接到 https://github.com/symplify/easy-coding-standard/

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\ChangelogLinker\ValueObject\Option;

return static function (ContainerConfigurator $containerConfigurator): void {
    $parameters = $containerConfigurator->parameters();
    // this parameter is detected from "git origin", but you can change it
    $parameters->set(Option::NAMES_TO_URLS, [
        'EasyCodingStandard' => 'https://github.com/symplify/easy-coding-standard/',
    ]);
};
 ## Unreleased

 ### Added

-#### EasyCodingStandard
+#### [EasyCodingStandard]
+
+[EasyCodingStandard]: https://github.com/symplify/easy-coding-standard/

5. 我能写更短的PR标题吗?

ECS-Run

只需在配置中添加别名即可

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\ChangelogLinker\ValueObject\Option;

return static function (ContainerConfigurator $containerConfigurator): void {
    $parameters = $containerConfigurator->parameters();
    // this parameter is detected from "git origin", but you can change it
    $parameters->set(Option::PACKAGE_ALIASES, [
        'CS' => 'CodingStandard',
    ]);
};

...它将被解析为 CodingStandard 包。


报告问题

如果您遇到错误或想请求新功能,请前往 Symplify monorepo issue tracker

贡献

此包的源代码包含在Symplify monorepo中。我们欢迎在 symplify/symplify 上为此包做出贡献。