A written in Rust tool for Python programs that automatically pull task id from branch name to commit message.
Let's imagine you have branch project_name/TASK-111-implement-feature
and you need
to provide the task TASK-111
into commit message.
Then you can just use this tool.
First, just add hook into .pre-commit-config.yaml
:
- repo: https://github.com/vanya909/pyrust-task-id-pre-commit
rev: 0.1.5
hooks:
- id: pyrust-task-id
stages: [commit-msg]
args:
- "project_name/(?P<task_template>TASK-[0-9]{3})-.*"
- "{subject}\\n\\n{body}\\n\\nTask ID: {task_id}"
Then run
pre-commit install --hook-type "commit-msg"
Then commit
git commit -m"My cool feature" -m"Can't wait to see this feature in prod."
And then you'll see following commit message:
My cool feature
Can't wait to see this feature in prod.
Task ID: TASK-111
This project uses standalone repo for pre-commit hook because it requires pre-build python wheels from PyPI