diff --git a/checkmk_weblate_syncer/config.py b/checkmk_weblate_syncer/config.py index 3a39877..6063baa 100644 --- a/checkmk_weblate_syncer/config.py +++ b/checkmk_weblate_syncer/config.py @@ -30,6 +30,7 @@ class PotModeConfig(BaseConfig, frozen=True): Path, AfterValidator(_validate_path_is_relative) ] locale_pot_path: Annotated[Path, AfterValidator(_validate_path_is_relative)] + commit_message: str class PoFilePair(BaseModel, frozen=True): @@ -39,3 +40,4 @@ class PoFilePair(BaseModel, frozen=True): class PoModeConfig(BaseConfig, frozen=True): po_file_pairs: Sequence[PoFilePair] + commit_message: str diff --git a/checkmk_weblate_syncer/git.py b/checkmk_weblate_syncer/git.py index 255fd11..4a88a95 100644 --- a/checkmk_weblate_syncer/git.py +++ b/checkmk_weblate_syncer/git.py @@ -35,11 +35,12 @@ def _repository_in_clean_state(path: Path, branch: str) -> Repo: def commit_and_push_files( repo: Repo, - files_to_push_to_repo: Sequence[Path], + files: Sequence[Path], + commit_message: str, ) -> None: try: - repo.index.add(files_to_push_to_repo) - repo.index.commit("Updating files") + repo.index.add(files) + repo.index.commit(commit_message) repo.remotes.origin.push() except CalledProcessError as e: LOGGER.error( diff --git a/checkmk_weblate_syncer/po.py b/checkmk_weblate_syncer/po.py index bb4de88..5a72dc2 100644 --- a/checkmk_weblate_syncer/po.py +++ b/checkmk_weblate_syncer/po.py @@ -54,7 +54,8 @@ def run(config: PoModeConfig) -> int: LOGGER.info("Committing and pushing .po files to checkmk repository") commit_and_push_files( repo=checkmk_repo, - files_to_push_to_repo=[success.path for success in successes], + files=[success.path for success in successes], + commit_message=config.commit_message, ) else: LOGGER.info("No changes in checkmk repository.") diff --git a/checkmk_weblate_syncer/pot.py b/checkmk_weblate_syncer/pot.py index a89d5cb..74abdc6 100644 --- a/checkmk_weblate_syncer/pot.py +++ b/checkmk_weblate_syncer/pot.py @@ -49,6 +49,7 @@ def run(config: PotModeConfig) -> int: LOGGER.info("Committing and pushing pot file to locale repository") commit_and_push_files( repo=locale_repo, - files_to_push_to_repo=[path_pot_file], + files=[path_pot_file], + commit_message=config.commit_message, ) return 0