diff --git a/src/templatebot/services/template.py b/src/templatebot/services/template.py index 7c82716..c3b7518 100644 --- a/src/templatebot/services/template.py +++ b/src/templatebot/services/template.py @@ -303,8 +303,7 @@ async def create_project_from_template( # noqa: PLR0915 C901 git_repo = GitClone.init_repo( path=project_dir, github_client=github_client ) - bot_actor = await git_repo.create_bot_actor() - git_repo.commit("Initial commit", actor=bot_actor) + git_repo.commit("Initial commit") git_repo.push(remote_url=github_repo_url, branch="main") # Create a Markdown code block showing the template variable names diff --git a/src/templatebot/storage/gitclone.py b/src/templatebot/storage/gitclone.py index bc5a635..91e10de 100644 --- a/src/templatebot/storage/gitclone.py +++ b/src/templatebot/storage/gitclone.py @@ -62,18 +62,17 @@ def add_remote(self, url: str, *, name: str = "origin") -> git.Remote: authed_url = self._create_authed_url(url) return self._repo.create_remote(name, authed_url) - async def create_bot_actor(self) -> git.Actor: + def create_bot_actor(self) -> git.Actor: """Create an actor for the bot.""" - username = config.github_username - response = await self._github_client.getitem( - "/users{/user}", url_vars={"user": username} + email = ( + f"{config.github_app_id}+{config.github_username}" + "[bot]@users.noreply.github.com" ) - uid = str(response["id"]) - email = f"{uid}+{username}@users.noreply.github.com" - return git.Actor(username, email) + return git.Actor(config.github_username, email) - def commit(self, message: str, *, actor: git.Actor) -> None: + def commit(self, message: str) -> None: """Commit all changes in the repository.""" + actor = self.create_bot_actor() self._repo.index.commit(message, author=actor, committer=actor) def push(self, *, remote_url: str, branch: str = "main") -> None: