🔧 FIX: Git identity setzen + Changes-Status checken via git status
docker-build-and-push / build (push) Successful in 18s
docker-build-and-push / build (push) Successful in 18s
This commit is contained in:
+33
-1
@@ -139,4 +139,36 @@ def push_changes(repo_path: Path, message: str = "Update 🧠", changelog_conten
|
||||
["git", "push"], cwd=repo_path, capture_output=True, text=True
|
||||
)
|
||||
|
||||
return {"success": result.returncode == 0, "output": result.stdout}
|
||||
return {"success": result.returncode == 0, "output": result.stdout}
|
||||
|
||||
|
||||
def get_git_status(repo_path: Path) -> dict:
|
||||
"""Prueft den Status eines Git-Repo fuer aenderungen."""
|
||||
# Setze git identity if not set (fuer Push ohne manuelle Konfig)
|
||||
try:
|
||||
subprocess.run(
|
||||
["git", "config", "--global", "user.name", "KI-Sparringpartner"],
|
||||
cwd=repo_path, capture_output=True
|
||||
)
|
||||
subprocess.run(
|
||||
["git", "config", "--global", "user.email", "ai@local.internal"],
|
||||
cwd=repo_path, capture_output=True
|
||||
)
|
||||
except Exception:
|
||||
pass # Falls git config fehlschlaegt, versuch trotzdem push
|
||||
|
||||
# Check fuer uncommitted changes
|
||||
result = subprocess.run(
|
||||
["git", "status", "--porcelain"],
|
||||
cwd=repo_path,
|
||||
capture_output=True,
|
||||
text=True
|
||||
)
|
||||
|
||||
has_changes = bool(result.stdout.strip())
|
||||
|
||||
return {
|
||||
"has_changes": has_changes,
|
||||
"uncommitted_files": result.stdout.strip().split("\n") if result.stdout else [],
|
||||
"can_push": has_changes
|
||||
}
|
||||
Reference in New Issue
Block a user