You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pre-Bump Scripts do not have access to packages installed before using commitizen-tools/commitizen-action #76
I have a closed-sample project where I make use of commitizen-action to handle versioning and changelog generation. I make use of .cz.toml's pre_bump_hooks configuration to add shell scripts which should be executed before version bump commit. The idea was to run a couple of cleanups based on the version information.
However, this fails as some external required packages are not made available to the scripts although they were installed in previous steps before commitizen-tools/commitizen-action is used.
Is it a possibility for you to re-write it in python or with coreutils? That's why I'm not a big fan pre_bump_hooks from commitizen.
Unfortunately, the scripts aren't portable to python due to tight dependence on the packages.
Is there an alternative to using pre_bump_hooks you can recommend?
I'd consider if the step can be done outside commitizen.
Thanks for this, I can already see possible ways I can handle the scripts outside commitizen. The only downside is I'd have a chore: cleanup after bump commit after each version bump. But I should be able to live with that 😅
- name: Setup pythonuses: actions/setup-python@v4with:
python-version: '3.x'
- run: pip install -U commitizen
- name: Next versionid: getnextversionrun: | export NEXT_VERSION=$(cz bump --git-output-to-stderr --dry-run | grep 'tag to create:' | grep -Eo '[0-9].+') echo "VERSION=$NEXT_VERSION" >> $GITHUB_OUTPUT
- name: Your NODEJS scriptenv:
CZ_PRE_NEW_VERSION: ${{ steps.getversion.outputs.VERSION }}# HERE the commitizen action
Note: I'm on a MAC so the grep flags might be different
I believe any change done in git will be picked up by commitizen and commit them in the bump commit. If that's not the case, try doing git add <files you changed>, at that point cz bump will definitely pick them up for the cz bump commit generated.
Activity
woile commentedon Sep 14, 2023
Interesting, I'm not sure how to solve this issue. The thing is that the action runs on its own docker image.
elcharitas commentedon Sep 15, 2023
That would explain it.
So far, a fix I have found is to install the required packages within the same script however, the workflow takes wayy too long when I do this.
woile commentedon Sep 15, 2023
Is it a possibility for you to re-write it in python or with coreutils? That's why I'm not a big fan
pre_bump_hooksfrom commitizen.elcharitas commentedon Sep 15, 2023
Unfortunately, the scripts aren't portable to python due to tight dependence on the packages.
Is there an alternative to using
pre_bump_hooksyou can recommend?woile commentedon Sep 15, 2023
What is your script doing? I'd consider if the step can be done outside commitizen. Which variables do you use from: https://commitizen-tools.github.io/commitizen/bump/#pre_bump_hooks
elcharitas commentedon Sep 15, 2023
I only make use of
CZ_PRE_NEW_VERSION.Thanks for this, I can already see possible ways I can handle the scripts outside commitizen. The only downside is I'd have a
chore: cleanup after bumpcommit after each version bump. But I should be able to live with that 😅woile commentedon Sep 15, 2023
You can have a step which installs commitizen with
pip install commitizen, then run something like:Or directly into a github action variable:
Note: I'm on a MAC so the
grepflags might be differentI believe any change done in git will be picked up by commitizen and commit them in the
bumpcommit. If that's not the case, try doinggit add <files you changed>, at that pointcz bumpwill definitely pick them up for thecz bumpcommit generated.elcharitas commentedon Sep 15, 2023
Thanks @woile I'm going to give this a try and let you know how it goes
elcharitas commentedon Sep 16, 2023
I'm closing this since my issue has been addressed already by @woile.
Thanks for the help