diff --git a/src/main/python/ddadevops/release_mixin/infrastructure_api.py b/src/main/python/ddadevops/release_mixin/infrastructure_api.py index d59722e..b09fd89 100644 --- a/src/main/python/ddadevops/release_mixin/infrastructure_api.py +++ b/src/main/python/ddadevops/release_mixin/infrastructure_api.py @@ -216,8 +216,12 @@ class GitApi(): self.system_api.run_checked('git', 'branch', '--show-current') return ''.join(self.system_api.stdout).rstrip() - def init(self): - self.system_api.run_checked('git', 'init', '-b', 'main') + def init(self, default_branch: str = "main"): + self.system_api.run_checked('git', 'init', '-b', default_branch) + + def set_user_config(self, email: str, name: str): + self.system_api.run_checked('git', 'config', 'user.email', email) + self.system_api.run_checked('git', 'config', 'user.name', name) def add_file(self, file_path: Path): self.system_api.run_checked('git', 'add', file_path) diff --git a/src/test/python/release_mixin/test_infrastructure_api.py b/src/test/python/release_mixin/test_infrastructure_api.py index d5b54dc..f59651c 100644 --- a/src/test/python/release_mixin/test_infrastructure_api.py +++ b/src/test/python/release_mixin/test_infrastructure_api.py @@ -20,6 +20,7 @@ def test_git_api(tmp_path: Path, monkeypatch: pt.MonkeyPatch): git_api = GitApi() git_api.init() + git_api.set_user_config("ex.ample@mail.com", "Ex Ample") git_api.add_file(th.TEST_FILE_NAME) git_api.commit("MINOR release") diff --git a/src/test/python/release_mixin/test_release_mixin.py b/src/test/python/release_mixin/test_release_mixin.py index f2c9aa5..6066f88 100644 --- a/src/test/python/release_mixin/test_release_mixin.py +++ b/src/test/python/release_mixin/test_release_mixin.py @@ -41,6 +41,7 @@ def test_release_mixin(tmp_path: Path, monkeypatch: pt.MonkeyPatch): git_api = GitApi() git_api.init() + git_api.set_user_config("ex.ample@mail.com", "Ex Ample") git_api.add_file(th.TEST_FILE_NAME) git_api.commit("MAJOR release")