Fixed Git integration

This commit is contained in:
2026-06-09 14:36:51 +03:00
parent b976e965f3
commit ad8035b908
2 changed files with 9 additions and 9 deletions
+6 -6
View File
@@ -28,17 +28,17 @@ class GiteaClient:
repo: str,
title: str,
body: str,
labels: list[str] | None = None,
) -> dict[str, Any]:
payload: dict[str, Any] = {"title": title, "body": body}
if labels:
payload["labels"] = labels
with self._client() as client:
response = client.post(
f"/api/v1/repos/{owner}/{repo}/issues",
json=payload,
json={"title": title, "body": body},
)
if response.is_error:
detail = response.text.strip() or response.reason_phrase
raise ValueError(
f"Gitea issue create failed ({response.status_code}): {detail}"
)
response.raise_for_status()
return response.json()
def close_issue(self, owner: str, repo: str, issue_number: int) -> dict[str, Any]:
+3 -3
View File
@@ -175,7 +175,6 @@ class ProjectService:
branch = f"feature/{story['ref']}-{slugify_branch(title)}"
gitea_issue_number = None
gitea_url = ""
labels = [issue_type] if issue_type else []
if binding and self.settings.gitea_configured:
gitea = GiteaClient()
@@ -186,12 +185,13 @@ class ProjectService:
taiga.story_url(taiga_proj.taiga_id, story["ref"]),
branch,
)
if issue_type:
gitea_body = f"**Тип:** {issue_type}\n\n{gitea_body}"
issue = gitea.create_issue(
binding.gitea_owner,
binding.gitea_repo,
title,
gitea_body,
labels=labels,
)
gitea_issue_number = issue["number"]
gitea_url = gitea.issue_url(
@@ -229,7 +229,7 @@ class ProjectService:
"url": gitea_url,
},
"branch": branch,
"labels": labels,
"issue_type": issue_type,
"subtasks": [{"ref": t.get("ref"), "subject": t.get("subject")} for t in subtasks],
"questions": structured.get("questions") or [],
"project_slug": taiga_proj.slug,