Skip to content

Infra: Git commit message check #29

Open
@EthanLin-TWer

Description

@EthanLin-TWer

  • 必须有自己的名字
  • 必须有 issue number(没需求就不做卡)
  • 必须有 前缀(feature/refactor/fix/chore/style/docs)
  • 前缀后面必须有冒号
  • 冒号后面必须有一个空格
  • 空格后面必须小写开头
  • 必须不多于70个字符
  • 详细的错误信息

后两个太难,暂时放弃了。

image

#!/bin/sh

commit_regex="\[Linesh\]\[#\d*\]\s\(Chore\|Feature\|Fix\|Docs\|Style\|Refactor\|Test\):\s[a-z]"
error_msg="Aborting commit, please double check your commit message."

if ! echo "$1" | grep -iqE "$commit_regex" ;
then
        echo "$error_msg" >&2
        exit 1
fi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions