Skip to content

falkben/pre-commit-prepend-jira-issue

Repository files navigation

pre-commit prepend jira issue

A pre-commit hook to prepend a Jira issue to a commit message, extracted from the current branch name.

With this hook installed, when you commit, if a Jira issue is found in your branch name, and a Jira issue is not already included in your commit message, the Jira issue from the branch name will be prepended to your commit message.

Install

  1. Install pre-commit if it's not already installed

    Globally with pipx:

    pipx install pre-commit

    Or any of the ways mentioned in the pre-commit installation docs.

  2. Add this hook to your .pre-commit-config.yaml file (create in root directory if it doesn't exist already).

    repos:
      - repo: https://github.com/falkben/pre-commit-prepend-jira-issue
        rev: v0.0.2
        hooks:
          - id: prepend-jira-issue
            stages: [commit-msg]
  3. Install this hook

    pre-commit install --hook-type commit-msg
  4. Commit the .pre-commit-config.yaml to your repo.

License

MIT

Inspiration

  1. https://github.com/radix-ai/auto-smart-commit
  2. https://agussarwono.com/article/add-ticket-to-your-commit/
  3. https://github.com/erskaggs/jira-pre-commit

Developer Notes

Install for local dev

Create virtual environment then install:

pip install -r dev-requirements.txt
pip install -e ".[dev]"

Create dev dependency lock file

pip-compile --extra dev -o dev-requirements.txt pyproject.toml

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages