Files

17 lines
522 B
Python

from typing import Any
from gitea.client import GiteaClient
class GitTools:
"""Tools for Gitea git ref operations."""
def __init__(self, client: GiteaClient) -> None:
self._client = client
def create_branch(self, owner: str, repo: str, ref: str, sha: str) -> str:
try:
self._client.create_ref(owner, repo, ref, sha)
return f"Branch '{ref}' created successfully in {owner}/{repo}."
except Exception as e:
return f"Error creating branch: {str(e)}"