- Notifications
You must be signed in to change notification settings - Fork261
Closed as not planned
Description
Feature Request
Description
Currently,Python Semantic Release does not support filtering commits byscopes ((pkg1),(pkg2)) in monorepos. This means that whenmultiple packages exist in a single repository, version bumps may happen incorrectly.
For example, given a monorepo with two packages:/packages/pkg1,/packages/pkg2
If a commit like:
feat(pkg1): Added new API featureappears,pkg2 should not get a version bump, but currently,semantic-release does not support filtering commits by scope.
Use cases
Monorepos with independent package versioning
- Developers working on multiple packages in a single repository often wanteach package to be released separately.
- Example: A commit
feat(pkg1): Added loggingshould bumppkg1's version, butpkg2's version should remain unchanged.
Scoped commit filtering for better release control
- Some teams use commit scopes (
feat(pkg1): ...,fix(pkg2): ...) tospecifically indicate which package was modified. - Currently,
semantic-releasereads all commits, making it difficult to version packages separately in monorepos.
- Some teams use commit scopes (
Possible implementation
- Introduce a
commit_scope_filteroption inpyproject.toml
[semantic_release.commit_parser_options]minor_tags = ["feat"]commit_scope_filter ="pkg1"
- If set,
semantic-releaseonly considers commits with the matching scope. - If not set,
semantic-releasebehaves as it does today (reading all commits).
- Modify commit parsing to respect the scope filter
- When calculating the next version,ignore commits that do not match the specified
commit_scope_filter.
- Extend
semantic-release changelogto support scope filtering
semantic-release changelog --scope=pkg1Alternative solutions
- Usingseparate repositories for each package (not ideal for monorepos).
- Manually filtering commits before running
semantic-releaseper package. - Running
semantic-releasein isolated environments per package and limitinggit logmanually.
This feature would greatly improvemonorepo support insemantic-release by ensuring thatonly relevant commits impact versioning for each package.
Best,
Asaf