GitPasha MCP Server - Ready for deployment
هذا الالتزام موجود في:
5
api/pulls/__init__.py
Normal file
5
api/pulls/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from api.pulls.open import api_open_pr
|
||||
|
||||
__all__ = [
|
||||
"api_open_pr"
|
||||
]
|
||||
39
api/pulls/open.py
Normal file
39
api/pulls/open.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import os
|
||||
from typing import Dict, Any
|
||||
from helpers import get_headers, build_client
|
||||
|
||||
BASE_URL = os.getenv(
|
||||
"GITPASHA_BASE_URL",
|
||||
"https://app.gitpasha.com/api/v1"
|
||||
).rstrip("/")
|
||||
|
||||
|
||||
def api_open_pr(
|
||||
repo: str,
|
||||
title: str,
|
||||
head: str,
|
||||
base: str,
|
||||
body: str = ""
|
||||
) -> Dict[str, Any]:
|
||||
username = os.getenv("GITPASHA__USERNAME", "")
|
||||
|
||||
if "/" not in repo:
|
||||
if not username:
|
||||
raise ValueError("GITPASHA__USERNAME not set in .env")
|
||||
repo = f"{username}/{repo}"
|
||||
|
||||
payload = {
|
||||
"title": title,
|
||||
"head": head,
|
||||
"base": base,
|
||||
"body": body
|
||||
}
|
||||
with build_client() as client:
|
||||
url = f"{BASE_URL}/repos/{repo}/pulls"
|
||||
res = client.post(
|
||||
url,
|
||||
headers=get_headers(),
|
||||
json=payload
|
||||
)
|
||||
res.raise_for_status()
|
||||
return res.json()
|
||||
المرجع في مشكلة جديدة
حظر مستخدم