-
-
Notifications
You must be signed in to change notification settings - Fork 281
feat(bump): added support for running arbitrary hooks during bump #644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(bump): added support for running arbitrary hooks during bump #644
Conversation
5ea9ba7
to
36d184a
Compare
Codecov ReportBase: 97.92% // Head: 98.01% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #644 +/- ##
==========================================
+ Coverage 97.92% 98.01% +0.09%
==========================================
Files 35 40 +5
Lines 1252 1715 +463
==========================================
+ Hits 1226 1681 +455
- Misses 26 34 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @skoef thanks for your contribution! I left a few questions. Also I like the name pre_bump_hooks
a bit better
tests/test_conf.py
Outdated
@@ -73,6 +83,8 @@ | |||
"version_files": ["commitizen/__version__.py", "pyproject.toml"], | |||
"style": [["pointer", "reverse"], ["question", "underline"]], | |||
"changelog_file": "CHANGELOG.md", | |||
"hooks_pre_bump": ["scripts/generate_documentation.sh"], | |||
"hooks_post_bump": ["scripts/slack_notification.sh"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better for us to add at least one run-able test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Lee-W I fully agree, but I'm not a real python dev myself and am not familiar with the pytest framework. If it wouldn't be too much work, could you perhaps pitch in here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, I'll take a deeper look later and see how I can help on this :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just added a test case to verify it
992a80e
to
103def9
Compare
@Lee-W I'm not sure why specifically the windows check failed, but do you know if it has something to do with passing env to subprocess? |
103def9
to
24f0f27
Compare
24f0f27
to
90bed7c
Compare
It seems to be something related to type annotation. I just fixed it and rebase the latest master to your branch. |
@Lee-W this got lost in your rebase, breaking environment support again |
@ysndr should be fixed now |
@skoef would it be possible for you to do rebase from the master branch (i.e. using |
To make commitizen integrate even better, new configuration keys pre_bump_hooks and post_bump_hooks were added to allow to run arbitrary commands prior to and right after running bump Closes: commitizen-tools#292
70494a3
to
26b38be
Compare
@Lee-W done! |
Uses PR'd fork with support for `post_bump_hooks` [1] [1]: commitizen-tools/commitizen#644
Uses PR'd fork with support for `post_bump_hooks` [1] [1]: commitizen-tools/commitizen#644
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@woile could you please take a look? |
LGTM |
During development of commitizen-tools#644, merging the hook environment variables with existing OS variables broke. This commit fixes that.
During development of commitizen-tools#644, merging the hook environment variables with existing OS variables broke. This commit fixes that.
During development of commitizen-tools#644, merging the hook environment variables with existing OS variables broke. This commit fixes that.
During development of commitizen-tools#644, merging the hook environment variables with existing OS variables broke.
During development of commitizen-tools#644, merging the hook environment variables with existing OS variables broke.
During development of #644, merging the hook environment variables with existing OS variables broke.
Description
To make commitizen integrate even better, new configuration keys hooks_pre_bump and hooks_post_bump were added to allow to run arbitrary commands prior to and right after running bump.
I've backported the work done by @janw and slightly adjusted it:
hooks_pre_bump
hooks after the versions have been updated but before they are committed and tagged, so additional documentation can be generated with the new version or other generators can be run and staged.Checklist
./scripts/format
and./scripts/test
locally to ensure this change passes linter check and testSteps to Test This Pull Request
cz bump
and notice theRunning hook
outputgit show HEAD
to seefoo.bar
is part of the latest releaseAdditional context
Closes: #292
Thanks to @janw to do the heavy lifting here.