Fixed Git integration
This commit is contained in:
@@ -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},
|
||||
)
|
||||
response.raise_for_status()
|
||||
if response.is_error:
|
||||
detail = response.text.strip() or response.reason_phrase
|
||||
raise ValueError(
|
||||
f"Gitea issue create failed ({response.status_code}): {detail}"
|
||||
)
|
||||
return response.json()
|
||||
|
||||
def close_issue(self, owner: str, repo: str, issue_number: int) -> dict[str, Any]:
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user