Add ability to run arbitrary hooks pre/post version bump
See original GitHub issueDescription
To use the currently available hook facilities, it is necessary to create a custom cz_ adapter class to use hooks during the version bump / changelog generation. I’d like to be able to run arbitrary hooks (i.e. a shell script or other external executable) from a simple configuration file section. In my specific use-case I’d like for the hooks to be run after the changelog generation and before the version bump in case of cz bump --changelog
(see also #290), but I can imaging the following hook locations to be useful:
- before changelog
- after changelog and before commit and tag
- after tag
Possible Solution
Implement hook facilities at the aforementioned locations. They should be configurable via the configuration file for example as follows, allowing for multiple commands to be run at a given location
[[tool.commitizen.hook_begin]]
command = "./update-something.sh"
[[tool.commitizen.hook_begin]]
command = "./do-another-thing.sh"
[[tool.commitizen.hook_before_commit]]
command = "./build-something-based-on-changelog.sh"
[tool.commitizen.hook_end]
command = "./push-artifacts.py"
Given commands should run with useful execution context, such as current and future version as arguments and/or environment variables.
I’d be happy to implement this as well. Cheers.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)
Awesome, I’ll make it presentable early next week and get back to you! 💪
Hey @janw I’m interested. I’d like to see it. Regards!