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

Pre-commit integration #165

Open
Wyko opened this issue Mar 26, 2024 · 3 comments
Open

Pre-commit integration #165

Wyko opened this issue Mar 26, 2024 · 3 comments

Comments

@Wyko
Copy link

Wyko commented Mar 26, 2024

Feature request

I noticed that in issue #62 there was mention of pre-commit hooks, and it got me thinking: Would you be able to create a hook for pre-commit that automatically bumps version on each commit?

From personal experience, pre-commit (the package) doesn't play nicely with manual pre-commit hooks, so it would be nice if we could integrate everything under their ecosystem. It would definitely help my workflow a lot!

@coordt
Copy link
Member

coordt commented Mar 26, 2024

I can't say that I've ever heard of a workflow that increments the version on commit. With the current workload I don't see this becoming a priority unless others are also interested.

@azataiot
Copy link

Incrementing the version on commit will be too much overkill.

Normally a commit is a simple state change that recorded.But a version is a complete state change in the code, like a feature, a new endpoint or a service etc.

@lnxpy
Copy link

lnxpy commented Aug 4, 2024

I'm just imagining how would your Linux kernel version look like then. It has over 1.2M commits by now. (torvalds/linux)

Technically, that's not a good idea. Neither is an awful one. In some very certain cases and situations, it might be helpful. As a solution, you are able to run shell scripts in your .pre-commit-config.yaml file.

You can simply put bump-my-version major/minor/patch in there, but be VERY careful as you might get trapped in a circular infinite loop of pre-commit checking and version-bumping.

When you git commit, your hook will get triggered. If the commit flag is enabled for bump-my-version, it'll commit once again, which will cause your hook to execute right after, bump the version and so on and so forth!

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

No branches or pull requests

4 participants