GitBuddy

您管理和维护 GitHub 仓库的好伙伴。

GitBuddy 可以帮助您:

生成变更日志

$ gitbuddy changelog --help
OVERVIEW: Create a changelog for GitHub repositories

USAGE: gitbuddy changelog [--since-tag <since-tag>] [--base-branch <base-branch>] [--sections] [--verbose]

OPTIONS:
  -s, --since-tag <since-tag>
                          The tag to use as a base. Defaults to the latest tag.
  -b, --base-branch <base-branch>
                          The base branch to compare with. Defaults to master.
  --sections              Whether the changelog should be split into sections. Defaults to false.
  --verbose               Show extra logging for debugging purposes
  -h, --help              Show help information.

此命令基于合并的 PR 和已修复的问题生成变更日志。一旦 PR 包含像 "Fixed #30" 这样的引用,问题 30 的标题将被包含在变更日志中。否则,将使用 Pull Request 的标题。

合并到 baseBranch 的 Pull request 将被用作变更日志的输入。只有在 sinceTag 创建日期之后合并的 pull request 才会被作为输入。

变更日志示例

这是一个取自 Mocker 的例子



如果您希望变更日志链接到在发布版本标记之前关闭的问题,请传递 --sections 参数,那么它将看起来像这样


已关闭的问题

已合并的 pull requests


生成发布版本

$ gitbuddy release --help
OVERVIEW: Create a new release including a changelog and publish comments on related issues.

USAGE: gitbuddy release [--changelog-path <changelog-path>] [--skip-comments] [--use-pre-release] [--target-commitish <target-commitish>] [--tag-name <tag-name>] [--release-title <release-title>] [--last-release-tag <last-release-tag>] [--base-branch <base-branch>] [--sections] [--verbose]

OPTIONS:
  -c, --changelog-path <changelog-path>
                          The path to the Changelog to update it with the latest changes.
  -s, --skip-comments     Disable commenting on issues and PRs about the new release.
  -p, --use-pre-release   Create the release as a pre-release.
  -t, --target-commitish <target-commitish>
                          Specifies the commitish value that determines where the Git tag is created
                          from. Can be any branch or commit SHA. Unused if the Git tag already exists.
                          Default: the repository's default branch (usually master).
  -n, --tag-name <tag-name>
                          The name of the tag. Default: takes the last created tag to publish as a GitHub
                          release.
  -r, --release-title <release-title>
                          The title of the release. Default: uses the tag name.
  -l, --last-release-tag <last-release-tag>
                          The last release tag to use as a base for the changelog creation. Default:
                          previous tag.
  -b, --base-branch <base-branch>
                          The base branch to compare with for generating the changelog. Defaults to
                          master.
  --sections              Whether the changelog should be split into sections. Defaults to false.
  --verbose               Show extra logging for debugging purposes
  -h, --help              Show help information.

release 命令可用于将最新的标签转换为 GitHub 发布版本,并将变更日志作为正文。变更日志由最新标签和上一个标签之间的所有更改生成。

更新变更日志文件

如果传递了 changelogPath,则变更日志将附加到变更日志文件的开头。它通常设置为 Changelog.md。最好在发布分支上使用它,这样您就可以提交更改并打开 PR。

发布评论

此发布命令的一个重要功能是自动将评论发布到与此发布版本一起发布的问题和 PR。

在问题上发布的评论

在 pull request 上发布的评论

使用 Mint 安装

您可以使用 Mint 如下安装 GitBuddy

$ mint install WeTransfer/GitBuddy

设置一个个人访问令牌,并将作用域设置为仅 repo。 通过将您的 GitHub 用户名与令牌组合,将此令牌添加为环境变量 GITBUDDY_ACCESS_TOKEN

export GITBUDDY_ACCESS_TOKEN="<username>:<access_token>"

该令牌与 GitHub API 一起使用,并使用 Basic HTTP 身份验证。

之后,您可以通过在您想要使用的仓库中执行它来直接使用它

$ gitbuddy --help
OVERVIEW: Manage your GitHub repositories with ease

USAGE: gitbuddy [--version] <subcommand>

OPTIONS:
  --version               Prints the current GitBuddy version
  -h, --help              Show help information.

SUBCOMMANDS:
  changelog               Create a changelog for GitHub repositories
  release                 Create a new release including a changelog and publish comments on related issues.

开发

swift run --package-path ../GitBuddy/ GitBuddy --help