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
How to use pre_bump_hook scripts with this action #78
I am interested in using this pre-bump-hooks built-in commitizen feature to update my repository documentation before create the tag and push the commit, like it is said in the site:
Useful when you need to generate documentation based on the new version. During execution of the script, some environment variables are available
It works pretty well in a local machine using the installed commitizen version (pip install -U commitizen) but, if I understood correctly, this action is a Docker Action, which means that it runs inside a pre-built docker image which does not contain the scripts that is referenced in my .cz.yaml configuration file, unless if I was able to mount a volume in this image containing my script, for instance (not sure if it is a regular approach in github actions - volume mount)
Is there any way to do it? Are you have some related issue in the roadmap?
The Docker image has your code mounted automatically. Otherwise it wouldn't be able to find the pyproject.toml or the .cz.toml depending on which one you are using. Now, the potential problem I see with the bump hooks is that if your dependencies require something that is not in the docker image... it becomes quite complicated to run the hook. If it's something like mkdocs, you can add it to extra_requirements and it should work.
Alternatively, you can split the version updates on the files, and the commit creation:
- run: cz bump --files-only
- run: ./scripts/docs
- run: git commit -am "bump: new version $(cz version -p)"
Triage: usage question; the limitation is by design.
This action is a Docker container action — cz bump runs inside the action's own image, which doesn't have your repo's tooling installed (your poetry, npm, custom scripts, etc.). So a pre_bump_hook that calls e.g. poetry run docs-generate will fail to find poetry.
Workarounds:
Run cz directly on the runner instead of via this action: pip install -U commitizen && cz bump — your hooks then run with full access to whatever you set up earlier in the job.
Use extra_requirements to install Python tooling into the action's image, if your hook only needs Python deps.
Move the pre_bump_hook work into a follow-up workflow step that runs after the action, gated on steps.cz.outputs.version != steps.cz.outputs.previous_version.
There's no code fix to make in the action for this.
Activity
woile commentedon Dec 6, 2023
The Docker image has your code mounted automatically. Otherwise it wouldn't be able to find the
pyproject.tomlor the.cz.tomldepending on which one you are using. Now, the potential problem I see with the bump hooks is that if your dependencies require something that is not in the docker image... it becomes quite complicated to run the hook. If it's something likemkdocs, you can add it toextra_requirementsand it should work.Alternatively, you can split the version updates on the files, and the commit creation:
- run: cz bump --files-only - run: ./scripts/docs - run: git commit -am "bump: new version $(cz version -p)"bearomorphism commentedon May 10, 2026
Triage: usage question; the limitation is by design.
This action is a Docker container action —
cz bumpruns inside the action's own image, which doesn't have your repo's tooling installed (yourpoetry,npm, custom scripts, etc.). So apre_bump_hookthat calls e.g.poetry run docs-generatewill fail to findpoetry.Workarounds:
czdirectly on the runner instead of via this action:pip install -U commitizen && cz bump— your hooks then run with full access to whatever you set up earlier in the job.extra_requirementsto install Python tooling into the action's image, if your hook only needs Python deps.pre_bump_hookwork into a follow-up workflow step that runs after the action, gated onsteps.cz.outputs.version != steps.cz.outputs.previous_version.There's no code fix to make in the action for this.