🚀 Initialer Commit: Gitea Sync AI Service mit Docker + OpenWebUI-Vorbereitung

This commit is contained in:
KI-Sparringpartner
2026-08-03 12:57:52 +02:00
commit f0bd062479
14 changed files with 362 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
import subprocess
from pathlib import Path
def clone_repo(repo_url: str, target_dir: Path, token: str = None):
"""Klont ein Repository in den Zielordner."""
if not target_dir.exists():
target_dir.mkdir(parents=True)
# URL mit Token (falls nötig)
if token and "@" not in repo_url:
repo_url = repo_url.replace("https://", f"https://{token}@")
result = subprocess.run(
["git", "clone", repo_url, str(target_dir)],
capture_output=True,
text=True
)
return {"success": result.returncode == 0, "output": result.stdout, "error": result.stderr}
def push_changes(repo_path: Path, message: str = "Update 🧠"):
"""Pusht lokale Änderungen ins Repository."""
result = subprocess.run(
["git", "add", "."], cwd=repo_path, capture_output=True, text=True
)
if result.returncode != 0:
return {"success": False, "error": f"git add fehlgeschlagen: {result.stderr}"}
result = subprocess.run(
["git", "commit", "-m", message], cwd=repo_path, capture_output=True, text=True
)
if result.returncode != 0 and "nothing to commit" not in result.stderr.lower():
return {"success": False, "error": f"Commit fehlgeschlagen: {result.stderr}"}
result = subprocess.run(
["git", "push"], cwd=repo_path, capture_output=True, text=True
)
return {"success": result.returncode == 0, "output": result.stdout}