Files
gitea_runner/utils.py
T

9 lines
302 B
Python

from pydantic import AnyHttpUrl
from pathlib import Path
def clone_repository(repo_url: AnyHttpUrl) -> Path:
print(f'cloning into {repo_url}')
repo_name = repo_url.split('/')[-1].strip('\.git')
dst_dir = Path(__file__).parent / repo_name
dst_dir.mkdir(exist_ok=True)
return dst_dir