Description
Description
Introduce an option (either in the configuration file or as a CLI argument) to filter the commits that will be considered for the version bump calculation. This feature would allow users to specify a path prefix, ensuring that only commits affecting files within the specified path are taken into account.
This feature would provide a basic way to handle version bumping in monorepos by allowing users to focus on changes within specific subdirectories and could be used by users until full support for monorepos is added to commitizen (I saw other issues mentioning other types of features for monorepo support so this could be used together with those other features).
Possible Solution
I went ahead and tried implementing my suggestion in a fork so that I could start testing it with an internal application (I did search for contributing guidelines, but I didn't look in the docs/ folder, so I didn't see this line before implementing, sorry).
Basically the changes I made are:
- Read a new config option,
path_prefix
. I didn't add this feature as a CLI argument but it can be added if wanted. - Use this config option to apply a filter using the already implemented
git.get_filenames_in_commit
function. - Filter the list of commits using the previously defined filter.
I can make a PR for this feature and also make any other changes as needed so that this feature can see the light of day :)
Additional context
You can see the test I implemented for an example of the feature working.
Additional context
No response
Activity