A fork of the add-msg-issue-prefix-hook that allows for default issues.
See also: https://github.com/pre-commit/pre-commit
Add this to your .pre-commit-config.yaml
- repo: https://github.com/RobertLD/add-msg-issue-prefix-hook
rev: v0.0.1 # Use the ref you want to point at
hooks:
- id: add-msg-issue-prefix
and install prepare-commit-msg hooks using
pre-commit install --hook-type prepare-commit-msg
Change how the issue is rendered to the commit message using the --template
argument.
- repo: https://github.com/RobertLD/add-msg-issue-prefix-hook
rev: v0.0.1 # Use the ref you want to point at
hooks:
- id: add-msg-issue-prefix
args:
- --template=[{}]
Add a default issue if one is not provided
- repo: https://github.com/RobertLD/add-msg-issue-prefix-hook
rev: v0.0.1 # Use the ref you want to point at
hooks:
- id: add-msg-issue-prefix
args:
- --default=[NOJIRA]
Customize where the issue key is inserted using regular expressions. The following example allows commit messages of the form feat: add feature
to be updated to feat: [ABC-123] add feature
.
- repo: https://github.com/RobertLD/add-msg-issue-prefix-hook
rev: v0.0.1 # Use the ref you want to point at
hooks:
- id: add-msg-issue-prefix
name: add-msg-issue-prefix-test
args: ["--insert-after", "^feat.?:|^fix.?:"]