Skip to content
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

BVHOOK_NEW_VERSION and BVHOOK_NEW_TAG environment variables not set for pre- or post-commit #234

Closed
shaug opened this issue Sep 14, 2024 · 1 comment · Fixed by #235
Closed

Comments

@shaug
Copy link

shaug commented Sep 14, 2024

  • bump-my-version version: 0.26.0
  • Python version: 3.11.9
  • Operating System: macOS

Description

According to the New version fields documentation for Hooks, BVHOOK_NEW_VERSION and BVHOOK-NEW_TAG should be available as environment variables. However, when I output the environment as part of my pre_commit_hooks and post_commit_hooks, I'm not seeing them. And when I look at the hooks.py source file, I'm not seeing any way these environment variables could be generated.

What I Did

I configured a pre-commit hook to output the BVHOOK environment variables:

[tool.bumpversion]
pre_commit_hooks = [
    "env | grep BVHOOK | sort",
]
post_commit_hooks = [
    "env | grep BVHOOK | sort",
]

And then I triggered a version bump with extra-verbose output:

bump-my-version bump pre_l -vv

This was in the output:

    Running pre-commit hooks:
      Running 'env | grep BVHOOK | sort'
        BVHOOK_BRANCH_NAME=my-branch
BVHOOK_COMMIT_SHA=1fd25a7902aec68e6d96ef529cd350d37fab6f2e
BVHOOK_CURRENT_MAJOR=0
BVHOOK_CURRENT_MINOR=1
BVHOOK_CURRENT_PATCH=0
BVHOOK_CURRENT_PRE_L=rc
BVHOOK_CURRENT_PRE_N=2
BVHOOK_CURRENT_TAG=v0.1.0rc2
BVHOOK_CURRENT_VERSION=0.1.0rc2
BVHOOK_DISTANCE_TO_LATEST_TAG=5
BVHOOK_IS_DIRTY=True
BVHOOK_NEW_MAJOR=0
BVHOOK_NEW_MINOR=1
BVHOOK_NEW_PATCH=0
BVHOOK_NEW_PRE_L=final
BVHOOK_NEW_PRE_N=0
BVHOOK_NOW=2024-09-13T17:30:59.895297
BVHOOK_SHORT_BRANCH_NAME=mybranch
BVHOOK_UTCNOW=2024-09-14T00:30:59.895301+00:00

...

                Running post-commit hooks:
                  Running 'env | grep BVHOOK | sort'
                    BVHOOK_BRANCH_NAME=my-bramnch
BVHOOK_COMMIT_SHA=7f74fb2e9e2b35645e52a328fdf170858a97c450
BVHOOK_CURRENT_MAJOR=0
BVHOOK_CURRENT_MINOR=1
BVHOOK_CURRENT_PATCH=0
BVHOOK_CURRENT_PRE_L=rc
BVHOOK_CURRENT_PRE_N=2
BVHOOK_CURRENT_TAG=v0.1.0rc2
BVHOOK_CURRENT_VERSION=0.1.0rc2
BVHOOK_DISTANCE_TO_LATEST_TAG=6
BVHOOK_IS_DIRTY=True
BVHOOK_NEW_MAJOR=0
BVHOOK_NEW_MINOR=1
BVHOOK_NEW_PATCH=0
BVHOOK_NEW_PRE_L=final
BVHOOK_NEW_PRE_N=0
BVHOOK_NOW=2024-09-13T17:50:38.442184
BVHOOK_SHORT_BRANCH_NAME=mybranch
BVHOOK_UTCNOW=2024-09-14T00:50:38.442189+00:00
@coordt coordt linked a pull request Sep 14, 2024 that will close this issue
@coordt
Copy link
Member

coordt commented Sep 14, 2024

@shaug Thanks for finding this. A fix is forthcoming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants