Skip to content

Provide a bump level setting for path filters in monorepos #1425

@H0R5E

Description

@H0R5E

Feature Request

Description

I would like to be able to set a fixed bump level for a given path filter when using ConventionalCommitMonorepoParser. Something along the lines of:

[tool.semantic_release.commit_parser_options.path_filters.x]
path = "../path/to/some/package/**"
max_bump_level = 2

With this configuration in place, the parser should then force any commits found by this filter with a higher bump level to the given maximum.

Use cases

My motivation for this is that I have packages in my monorepo that are dependant on other packages.

For example:

  • let's say pkg-a depends on pkg-b
  • if pkg-b gets an update, I also want to release pkg-a with the new version of pkg-b as a dependency
  • to do this, I set a path filter in pkg-a to watch pkg-b for changes
  • the changes made to pkg-b are major or breaking
  • the path filters as they are now will then force the change to pkg-a to also be major or breaking

In the above scenario, I just want the bump to pkg-a to be minor, unless I have made some changes specific to pkg-a that warrant a higher level.

Note that I am using a poetry plugin to automatically rewrite path dependencies to their released version when building for PyPI. I therefore don't have to make any changes to pkg-a when pkg-b updates for the dependency specification to be modified.

Possible implementation

Maybe by overriding the bump level returned from the parse_message method?

Alternative solutions

I've tried to think of a way of setting up the current configuration where I can get a similar result, but I have not had any success.

(EDIT: I've just thought about watching just the pyproject.toml file of the other project, but I would have to be careful to exclude changes to it from any commits with higher level types.)

Any help is gratefully received,

Thanks,

Mat

NEXT DAY EDIT: I just read the custom parser documentation, so I will have a go at rolling my own with this functionality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureA new feature or a feature requesttriagewaiting for initial maintainer review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions