Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Commit parser w/ path filter for monorepos #614

Closed
Labels
featureA new feature or a feature requestreleased
@lucasvieirasilva

Description

@lucasvieirasilva

Description

Adding theuse_only_cwd_commits config makes it possible to make the semantic release look for commits in thecwd folder only.

The default behavior is any commit in the repo can trigger a package release.

https://github.com/python-semantic-release/python-semantic-release/blob/master/semantic_release/vcs_helpers.py#L19-L26

_repo:Optional[Repo]_sub_directory=""try:_repo=Repo(".",search_parent_directories=True)ifconfig.get("use_only_cwd_commits")andconfig.get("version_source")=="commit":_sub_directory=os.path.relpath(os.getcwd(),_repo.working_dir)exceptInvalidGitRepositoryError:_repo=None

it will be good to have a config option to define one or more folders in the repo to semantic release CLI look for commits.

Use cases

Monorepo: When you have multiple packages in the same repo, you can useuse_only_cwd_commits to force the semantic release to look for commits only in the package folder.

However, when you have local dependencies that could potentially trigger the release of the application, it is required to look at multiple folders to decide if a release is necessary.

Issue reference:lucasvieirasilva/nx-plugins#122

Example:

- apps/app1/pyproject.toml- libs/lib1/pyproject.toml

In this example,app1 referenceslib1 as a local dependency using the Poetry path referencehttps://python-poetry.org/docs/dependency-specification/#path-dependencies

...[tool.poetry]name ="app1"...    [tool.poetry.dependencies.lib1]path ="../../libs/lib1"develop =true...

If something changes in thelib1 it should trigger theapp1 release, however, the commit path is only in thelibs/lib1 folder, not in theapps/app1 folder.

In this case, theuse_only_cwd_commits config isn't gonna work.

If we have the option to specify multiple paths for the commit analyzer, I could explicitly referencelibs/lib1 in theapps/app1/pyproject.toml semantic release config.

Possible implementation

  • a new config entrycommit_paths that accepts a list of paths.
[tool.semantic_release]version_variable = ["pyproject.toml:version"]branch ="main"upload_to_pypi =falseupload_to_release =falsecommit_paths = ["apps/app1","libs/lib1"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureA new feature or a feature requestreleased

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp