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

Add option to include additional files to bump #237

Open
ziima opened this issue Sep 23, 2024 · 7 comments
Open

Add option to include additional files to bump #237

ziima opened this issue Sep 23, 2024 · 7 comments
Labels
feature-request New feature or request

Comments

@ziima
Copy link
Collaborator

ziima commented Sep 23, 2024

Description

I'd like to suggest a new option to include additional files to bump commit. This would be especially useful to include changelog or similar release-related files.

Currently, I use --allow-dirty. But that doesn't ensure the changelog is included to the git stage. This may cause the commit/tag to be created without necessary files.

@coordt coordt added the feature-request New feature or request label Sep 23, 2024
@coordt
Copy link
Member

coordt commented Sep 23, 2024

I understand your request. Could you provide some thoughts on how you would like it to work (configurations/settings, failure handling, etc)?

@coordt
Copy link
Member

coordt commented Oct 12, 2024

Could the hooks functionality work? You can have a script that will add whatever files you want before the commit.

@ziima
Copy link
Collaborator Author

ziima commented Oct 13, 2024

It seems that could work, I have to try that sometime. Thanks for pointing it out.

@ziima
Copy link
Collaborator Author

ziima commented Oct 23, 2024

OK, I tried hook like:

pre_commit_hooks = [
    "git add CHANGELOG.rst",
]

which works fine. The only problem is that I still have to use --allow-dirty to prevent bump-my-version from failing on changes in repository.

@coordt
Copy link
Member

coordt commented Oct 23, 2024

Then there must be other modified files. Add the hook 'git status' to see the state. Might need to run bump my version with -vvv

@ziima
Copy link
Collaborator Author

ziima commented Oct 24, 2024

Nope. It's an inherent feature of the process.

The order of events is:

  1. Change the CHANGELOG.rst
  2. bump-my-version bump ...
    1. check dirty files
    2. run pre_commit_hooks - would add CHANGELOG.rst

It's the same with setup_hooks.

I think it's OK to have check of dirty files before anything else to prevent unwanted changes to the code. But an option to list files which may be dirty would help. Something like:

# These files are ignored in dirty check, event if --no-allow-dirty.
allow_dirty_files = ['CHANGELOG.rst', 'docs/changelog/*']

@coordt
Copy link
Member

coordt commented Oct 26, 2024

Thank you for the two PRs. I've given you write permission to the repository.

Do you think you could create a branch with the changes? It would help us both out.

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

No branches or pull requests

2 participants