跳转到主要内容

commitizen with kpn style

项目描述

KPN'S COMMITIZEN

PyPI Package latest release PyPI Package download count (per month) Docker Image Version (latest by date)

Example commit

关于

Python的commitizen插件,使用KPN提交规则来升级版本、更新文件和生成变更日志。

KPN规则摘要

模式

<PREFIX> <SUBJECT> (#<ISSUE_ID>)

<LONG_DESCRIPTION>
前缀 SemVer关系 描述
FIX PATCH 向后兼容的更改,用于修复某些内容
OPT PATCH 其他更改,如重构和文档,与旧版本兼容
新增 较小 新功能
破坏性更改 主要 破坏性更改

示例

NEW: Add login screen (#MY-123)

更多信息

安装

在您的系统中全局安装

python -m pip install --user cz-kpn

或将 cz-kpn 添加到您的项目中

poetry add cz-kpn --group dev

快速入门

在项目中初始化 cz-kpn

回答在

cz init

版本升级和变更日志中出现的

只需运行

cz bump

提交

cz commit

或快捷键

cz c

使用 Docker

cmd="cz -n cz_kpn commit"
docker run --rm -it -v $(pwd):/app kpnnl/cz-kpn:3.2.10 $cmd

功能

客户端工具,用于协助创建提交

Example commit]

注意:gif 已过时

此命令对于新手或忘记每个更改类型含义时很有用。它将显示一个提示,引导用户创建提交。

cz commit
git cz commit

自动版本升级

自动版本升级并生成变更日志。

cz bump --changelog

注意:如果 update_changelog_on_bump = true,则不需要 --changelog 标志

Example bump

自动生成变更日志

如果您不想生成标签并升级版本,请运行

cz changelog

这将创建一个包含未发布提交的变更日志,或者您可以运行

cz changelog --incremental

仅添加缺失的更改。如果您已手动修改了变更日志,这很有用。

验证提交信息

此命令将告诉您在给定范围内是否存在任何有效或无效的提交信息。

您还可以将其添加到 .pre-commit 钩子或作为 git 钩子手动添加。

更多信息请参阅 commitizen 网站

cz check --rev-range ugnu348hg84hg84g..j8fj84g84h84hg83h2392

将提交链接添加到变更日志

commit_url 参数添加到配置中,使用 $COMMIT_REV 作为变量,您可以查看此项目的 .cz.toml 作为示例

[tool.commitizen]
...
commit_url = "https://YOUR_DOMAIN/projects/YOUR_GROUP/repos/YOUR_PROJECT/commits/$COMMIT_REV"

配置

建议运行 cz init,它将帮助您创建正确的配置和文件。

您也可以手动添加到您的 pyproject.toml 或创建一个 .cz.toml 文件

[tool.commitizen]
name = "cz_kpn"
version = "<YOUR_CURRENT_VERSION>"
version_files = [
  "src/__version__.py"
]
slack_channel = "ddci-notifications"

帮助

cz --help

内容

$ cz --help
Commitizen is a cli tool to generate conventional commits.
For more information about the topic go to https://conventionalcommits.org/

options:
  -h, --help            show this help message and exit
  --debug               use debug mode
  -n NAME, --name NAME  use the given commitizen (default: cz_conventional_commits)
  -nr NO_RAISE, --no-raise NO_RAISE
                        comma separated error codes that won't rise error, e.g: cz -nr 1,2,3 bump. See codes at
                        https://commitizen-tools.github.io/commitizen/exit_codes/

commands:
  {init,commit,c,ls,example,info,schema,bump,changelog,ch,check,version}
    init                init commitizen configuration
    commit (c)          create new commit
    ls                  show available commitizens
    example             show commit example
    info                show information about the cz
    schema              show commit schema
    bump                bump semantic version based on the git log
    changelog (ch)      generate changelog (note that it will overwrite existing file)
    check               validates that a commit message matches the commitizen schema
    version             get the version of the installed commitizen or the current project (default: installed commitizen)

贡献

阅读 贡献指南

在 GitHub Action 中使用

name: Bump version and generate changelog

on:
  push:
    branches:
      - main

jobs:
  bump-version:
    if: "!startsWith(github.event.head_commit.message, 'BUMP:')"
    runs-on: ubuntu-latest
    name: "Bump version and create changelog with commitizen"
    steps:
      - name: Check out
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
          token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
      - name: Create bump and changelog
        uses: commitizen-tools/commitizen-action@master
        with:
          github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
          changelog_increment_filename: body.md
          extra_requirements: "cz-kpn"
      - name: Release
        uses: softprops/action-gh-release@v1
        with:
          body_path: "body.md"
          tag_name: ${{ env.REVISION }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

更多信息请参阅 commitizen 文档

项目详情


下载文件

下载您平台上的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源代码分发

cz_kpn-3.2.10.tar.gz (806.6 kB 查看哈希值)

上传时间 源代码

构建分发

cz_kpn-3.2.10-py3-none-any.whl (804.4 kB 查看哈希值)

上传时间 Python 3

由...