diff --git a/library_generation/test/resources/goldens/pr_description-golden.txt b/library_generation/test/resources/goldens/pr_description-golden.txt index d4db06a6ad..1a0f874936 100644 --- a/library_generation/test/resources/goldens/pr_description-golden.txt +++ b/library_generation/test/resources/goldens/pr_description-golden.txt @@ -2,10 +2,10 @@ This pull request is generated with proto changes between [googleapis/googleapis BEGIN_COMMIT_OVERRIDE BEGIN_NESTED_COMMIT -chore: update repo-level parameter gapic_generator_version to 1.2.3 +fix(deps): update the Java code generator (gapic-generator-java) to 1.2.3 END_NESTED_COMMIT BEGIN_NESTED_COMMIT -chore: update repo-level parameter libraries_bom_version to 2.3.4 +chore: update the libraries_bom version to 2.3.4 END_NESTED_COMMIT BEGIN_NESTED_COMMIT feat: Make Layout Parser generally available in V1 diff --git a/library_generation/test/utils/commit_message_formatter_unit_tests.py b/library_generation/test/utils/commit_message_formatter_unit_tests.py index 72d7d9fc94..16e3fffdfc 100644 --- a/library_generation/test/utils/commit_message_formatter_unit_tests.py +++ b/library_generation/test/utils/commit_message_formatter_unit_tests.py @@ -186,10 +186,10 @@ def test_format_repo_level_change_success(self): self.assertEqual( [ "BEGIN_NESTED_COMMIT", - "chore: update repo-level parameter gapic_generator_version to 1.2.3", + "fix(deps): update the Java code generator (gapic-generator-java) to 1.2.3", "END_NESTED_COMMIT", "BEGIN_NESTED_COMMIT", - "chore: update repo-level parameter libraries_bom_version to 2.3.4", + "chore: update the libraries_bom version to 2.3.4", "END_NESTED_COMMIT", "BEGIN_NESTED_COMMIT", "chore: update repo-level parameter protoc_version to 3.4.5", diff --git a/library_generation/utils/commit_message_formatter.py b/library_generation/utils/commit_message_formatter.py index 3bde927443..5b75db51a0 100644 --- a/library_generation/utils/commit_message_formatter.py +++ b/library_generation/utils/commit_message_formatter.py @@ -15,6 +15,15 @@ from git import Commit from library_generation.model.config_change import ConfigChange, ChangeType +from library_generation.model.generation_config import ( + GAPIC_GENERATOR_VERSION, + LIBRARIES_BOM_VERSION, +) + +PARAM_TO_COMMIT_MESSAGE = { + GAPIC_GENERATOR_VERSION: "fix(deps): update the Java code generator (gapic-generator-java) to", + LIBRARIES_BOM_VERSION: "chore: update the libraries_bom version to", +} def format_commit_message(commits: dict[Commit, str], is_monorepo: bool) -> list[str]: @@ -62,14 +71,10 @@ def format_repo_level_change(config_change: ConfigChange) -> list[str]: for repo_level_change in config_change.change_to_libraries.get( ChangeType.REPO_LEVEL_CHANGE, [] ): - messages.extend( - __wrap_nested_commit( - [ - f"chore: update repo-level parameter {repo_level_change.changed_param} to " - f"{repo_level_change.current_value}" - ] - ) - ) + message = f"chore: update repo-level parameter {repo_level_change.changed_param} to {repo_level_change.current_value}" + if repo_level_change.changed_param in PARAM_TO_COMMIT_MESSAGE: + message = f"{PARAM_TO_COMMIT_MESSAGE.get(repo_level_change.changed_param)} {repo_level_change.current_value}" + messages.extend(__wrap_nested_commit([message])) return messages