基于GitHub里程碑或标签生成变更日志
项目描述
Loghub
项目详情
构建状态
描述
基于里程碑或标签的GitHub变更日志生成器。
输出示例
实际效果如何?loghub的0.3版本输出如下
## Version 0.3 (2017-10-10)
### Issues Closed
#### Enhancements
* [Issue 63](https://github.com/spyder-ide/loghub/issues/63) - Add PR link / commit link inside issue ([PR 69](https://github.com/spyder-ide/loghub/pull/69))
In this release 1 issue was closed.
### Pull Requests Merged
* [PR 69](https://github.com/spyder-ide/loghub/pull/69) - PR: Add extra links for related issues and prs ([63](https://github.com/spyder-ide/loghub/issues/63))
In this release 1 pull request was closed.
您可以在loghub的CHANGELOG.md或spyder的CHANGELOG.md中查看更完整的输出示例。
安装
使用pip
pip install loghub
使用conda
conda install loghub -c conda-forge
或
conda install loghub -c spyder-ide
用法
loghub可用于根据里程碑或标签生成变更日志。
在项目中使用里程碑来跟踪发布时,我们可以使用例如
loghub spyder-ide/spyder --milestone v3.0
在项目中使用里程碑来跟踪工作块但不是发布时,我们可以使用标签来获取最新发布后的更改,例如
loghub spyder-ide/spyder --since-tag v3.0.0b7
或者如果使用 loghub 生成旧版本更改日志(或更新更改日志),我们也可以使用标签来限制范围,例如
loghub spyder-ide/spyder --since-tag v3.0.0b7 --until-tag v3.0.0
对于私有仓库,只需添加用户名和密码参数,例如
loghub spyder-ide/spyder --since-tag v3.0.0b7 --since-tag v3.0.0 --username <username> --password <password>
或者,只需添加用户名,就会弹出密码提示,例如
loghub spyder-ide/spyder --since-tag v3.0.0b7 --since-tag v3.0.0 --username <username>
或者生成一个 Github 访问令牌并使用它,例如
loghub spyder-ide/spyder --since-tag v3.0.0b7 -until-tag v3.0.0 --token <token>
重要
由于 Github API 的速率限制,建议始终使用访问令牌或用户名和密码进行身份验证。
ZenHub 集成
如果你的项目正在使用 Zenhub 来管理工作流程,你也可以使用 Zenhub 版本来创建你的更改日志。
loghub spyder-ide/spyder --zenhub-release "spyder v4.1.0" --zenhub-token <zenhub-token>
重要
为了使 Zenhub 集成工作,你需要始终使用 Zenhub 令牌。你可以在你的 仪表板 中生成一个。这里同样适用 Github API 的速率限制,因此建议始终使用访问令牌或用户名和密码进行身份验证。
loghub spyder-ide/spyder --zenhub-release "spyder v4.1.0" --zenhub-token <zenhub-token> --token <github-token>
高级用法
过滤 PR 基础分支
可以过滤显示的拉取请求,根据它们合并的分支(基础分支)进行过滤
loghub spyder-ide/spyder --branch 3.x
按标签过滤问题/PR
要过滤显示的问题,我们可以使用正则表达式
loghub spyder-ide/spyder --issue-label-regex "Type.*" --milestone v3.1
这将过滤所有以 类型 开头的问题
对 PR 也可以这样做
loghub spyder-ide/spyder --pr-label-regex "<some-regex>" --milestone v3.1
按标签分组问题
显示的问题可以按标签分组
loghub spyder-ide/spyder --issue-label-group "Type-Bug" "Bugs Fixed" --issue-label-group "Type-Enhancement" "New Features" --milestone v3.1
这将导致问题分为两个部分,分别以 已修复的错误 和 新功能 为标题。
输出格式
Loghub 提供两种格式
- changelog,这是默认格式,包括问题链接和 PR 链接
- release,不包括链接
loghub spyder-ide/spyder --milestone v3.1 --format release
自定义模板
Loghub 使用 Jinja2 模板来格式化输出。如果当前模板不符合你的需求,你可以复制默认的 templates <https://github.com/spyder-ide/loghub/tree/master/loghub/templates>
并创建一个新的模板,并将路径提供为
loghub spyder-ide/spyder --milestone v3.1 --template <PATH_TO_TEMPLATE>
详细的 CLI 参数
usage: loghub [-h] [-u USERNAME] [-p PASSWORD] [-t TOKEN] [-zt ZENHUB_TOKEN]
[-m MILESTONE] [-zr ZENHUB_RELEASE] [-st SINCE_TAG]
[-ut UNTIL_TAG] [-b BRANCH]
[-ilg ISSUE_LABEL_GROUPS [ISSUE_LABEL_GROUPS ...]]
[-plg PR_LABEL_GROUPS [PR_LABEL_GROUPS ...]]
[-lg LABEL_GROUPS [LABEL_GROUPS ...]] [-ilr ISSUE_LABEL_REGEX]
[-plr PR_LABEL_REGEX] [-f OUTPUT_FORMAT] [--template TEMPLATE]
[--batch {milestones,tags}] [--no-prs]
repository
Script to print the list of issues and pull requests closed in a given
milestone, tag including additional filtering options.
positional arguments:
repository Repository name to generate the Changelog for, in the
form user/repo or org/repo (e.g. spyder-ide/spyder)
optional arguments:
-h, --help show this help message and exit
-u USERNAME, --username USERNAME
Github user name
-p PASSWORD, --password PASSWORD
Github user password
-t TOKEN, --token TOKEN
Github access token
-zt ZENHUB_TOKEN, --zenhub-token ZENHUB_TOKEN
Zenhub access token
-m MILESTONE, --milestone MILESTONE
Github milestone to get issues and pull requests for
-zr ZENHUB_RELEASE, --zenhub-release ZENHUB_RELEASE
Zenhub release to get issues and pull requests for
-st SINCE_TAG, --since-tag SINCE_TAG
Github issues and pull requests since tag
-ut UNTIL_TAG, --until-tag UNTIL_TAG
Github issues and pull requests until tag
-b BRANCH, --branch BRANCH
Github base branch for merged PRs
-ilg ISSUE_LABEL_GROUPS [ISSUE_LABEL_GROUPS ...], --issue-label-group ISSUE_LABEL_GROUPS [ISSUE_LABEL_GROUPS ...]
Groups the generated issues by the specified label.
This optiontakes 1 or 2 arguments, where the first one
is the label to match and the second one is the label
to print on the finaloutput
-plg PR_LABEL_GROUPS [PR_LABEL_GROUPS ...], --pr-label-group PR_LABEL_GROUPS [PR_LABEL_GROUPS ...]
Groups the generated PRs by the specified label. This
optiontakes 1 or 2 arguments, where the first one is
the label to match and the second one is the label to
print on the finaloutput
-lg LABEL_GROUPS [LABEL_GROUPS ...], --label-group LABEL_GROUPS [LABEL_GROUPS ...]
Groups the generated issues and PRs by the specified
label. This option takes 1 or 2 arguments, where the
first one is the label to match and the second one is
the label to print on the final output
-ilr ISSUE_LABEL_REGEX, --issue-label-regex ISSUE_LABEL_REGEX
Label issue filter using a regular expression filter
-plr PR_LABEL_REGEX, --pr-label-regex PR_LABEL_REGEX
Label pull request filter using a regular expression
filter
-f OUTPUT_FORMAT, --format OUTPUT_FORMAT
Format for print, either 'changelog' (for Changelog.md
file) or 'release' (for the Github Releases page).
Default is 'changelog'. The 'release' option doesn't
generate Markdown hyperlinks.
--template TEMPLATE Use a custom Jinja2 template file
--batch {milestones,tags}
Run loghub for all milestones or all tags
--no-prs Run loghub without any pull requests output
--no-related-prs Do not display related prs on issues
--no-related-issues Do not display related issues on prs
标签实用工具 CLI 参数
loghub 包含一个额外的工具来获取或更新标签。
usage: loghub-labels [-h] [-u USERNAME] [-p PASSWORD] [-t TOKEN]
[-a [{get,update}]] [-f FILENAME]
repository
positional arguments:
repository Repository name to generate the Changelog for, in the
form user/repo or org/repo (e.g. spyder-ide/spyder)
optional arguments:
-h, --help
show this help message and exit
-u USERNAME, --username USERNAME
Github user name
-p PASSWORD, --password PASSWORD
Github user password
-t TOKEN, --token TOKEN
Github access token
-a [{get,update}], --action [{get,update}]
Action to take
-f FILENAME, --filename FILENAME
File for storing labels
贡献
每个人都欢迎贡献!
支持者
通过每月捐款支持我们,帮助我们继续我们的活动。
赞助商
成为赞助商,让您的徽标出现在我们的 Github README 中。
项目详情
下载文件
下载适合您的平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。
源分布
构建分布
loghub-0.5.1.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | cea67512cddbe3c8d2e8f6e2010d10b269f2f3f53ca767c09ccd549e316185a7 |
|
MD5 | c80b8f79c98384e0008f45476ca7c9c2 |
|
BLAKE2b-256 | de3e8d92723ba2a7a2d4314b5f846a547d5670d39e3a4cf4425e3a5e93bda317 |