Skip to content

RobertLD/add-msg-issue-prefix-hook

 
 

Repository files navigation

issue_prefix_hook

A fork of the add-msg-issue-prefix-hook that allows for default issues.

See also: https://github.com/pre-commit/pre-commit

Using with 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

Optional template argument

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=[{}]

Optional default argument

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]

Optional insert after argument

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.?:"]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%