Skip to content

Commit

Permalink
change commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeWang1127 committed Jun 10, 2024
1 parent 5867fd7 commit 152284c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
21 changes: 13 additions & 8 deletions library_generation/utils/commit_message_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down Expand Up @@ -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


Expand Down

0 comments on commit 152284c

Please sign in to comment.