feat: add merge_pull_request to GiteaClient #3

Merged
michael merged 1 commits from feat/client-merge-method into master 2026-06-30 22:01:45 +02:00
+19
View File
@@ -429,3 +429,22 @@ class GiteaClient(IssuesClient, PullRequestsClient, FilesClient, RefsClient, Rep
except Exception as e: except Exception as e:
print(f"Error marking notification thread {thread_id} as read: {e}") print(f"Error marking notification thread {thread_id} as read: {e}")
return False return False
def merge_pull_request(
self, owner: str, repo: str, pull_number: int, style: str = "squash", title: str = "", message: str = ""
) -> bool:
try:
with httpx.Client() as client:
url = f"{self.base_url}/api/v1/repos/{owner}/{repo}/pulls/{pull_number}/merge"
data: dict[str, Any] = {
"Do": style,
"MergeTitleField": title,
"MergeMessageField": message,
}
response = client.post(url, headers=self.headers, json=data)
response.raise_for_status()
return True
except Exception as e:
print(f"Error merging pull request {pull_number}: {e}")
raise