feat(F.16): Gitea plugin review, test & public release — v3.6.0

- Added update_webhook and delete_label tools (58 total Gitea tools)
- 97 unit tests (test_gitea_plugin.py)
- Gitea now public for all users (DEFAULT_PUBLIC_PLUGINS)
- Fixed merge_pull_request optional field handling

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-02 07:45:17 +02:00
parent 4f0c2f9bb0
commit 2c9d4ed3d2
11 changed files with 1309 additions and 19 deletions

View File

@@ -295,6 +295,25 @@ def get_tool_specifications() -> list[dict[str, Any]]:
},
"scope": "write",
},
{
"name": "delete_label",
"method_name": "delete_label",
"description": "Delete a label from a repository.",
"schema": {
"type": "object",
"properties": {
"owner": {"type": "string", "description": "Repository owner", "minLength": 1},
"repo": {"type": "string", "description": "Repository name", "minLength": 1},
"label_id": {
"type": "integer",
"description": "Label ID to delete",
"minimum": 1,
},
},
"required": ["owner", "repo", "label_id"],
},
"scope": "write",
},
# === MILESTONES ===
{
"name": "list_milestones",
@@ -499,6 +518,13 @@ async def create_label(
return json.dumps(result, indent=2)
async def delete_label(client: GiteaClient, owner: str, repo: str, label_id: int) -> str:
"""Delete a label"""
await client.delete_label(owner, repo, label_id)
result = {"success": True, "message": f"Label {label_id} deleted successfully"}
return json.dumps(result, indent=2)
# Milestone operations
async def list_milestones(
client: GiteaClient, owner: str, repo: str, state: str | None = None

View File

@@ -526,12 +526,13 @@ async def merge_pull_request(
delete_branch_after_merge: bool = False,
) -> str:
"""Merge a pull request"""
data = {
"Do": method,
"MergeTitleField": title,
"MergeMessageField": message,
"delete_branch_after_merge": delete_branch_after_merge,
}
data: dict = {"Do": method}
if title is not None:
data["MergeTitleField"] = title
if message is not None:
data["MergeMessageField"] = message
if delete_branch_after_merge:
data["delete_branch_after_merge"] = True
merge_result = await client.merge_pull_request(owner, repo, pr_number, data)
result = {
"success": True,

View File

@@ -159,6 +159,79 @@ def get_tool_specifications() -> list[dict[str, Any]]:
},
"scope": "read",
},
{
"name": "update_webhook",
"method_name": "update_webhook",
"description": "Update an existing webhook's configuration, events, or active status.",
"schema": {
"type": "object",
"properties": {
"owner": {"type": "string", "description": "Repository owner", "minLength": 1},
"repo": {"type": "string", "description": "Repository name", "minLength": 1},
"webhook_id": {
"type": "integer",
"description": "Webhook ID to update",
"minimum": 1,
},
"url": {
"anyOf": [{"type": "string", "format": "uri"}, {"type": "null"}],
"description": "New webhook URL",
},
"events": {
"anyOf": [
{
"type": "array",
"items": {
"type": "string",
"enum": [
"create",
"delete",
"fork",
"push",
"issues",
"issue_assign",
"issue_label",
"issue_milestone",
"issue_comment",
"pull_request",
"pull_request_assign",
"pull_request_label",
"pull_request_milestone",
"pull_request_comment",
"pull_request_review_approved",
"pull_request_review_rejected",
"pull_request_review_comment",
"pull_request_sync",
"wiki",
"repository",
"release",
],
},
},
{"type": "null"},
],
"description": "Updated list of events to trigger webhook",
},
"content_type": {
"anyOf": [
{"type": "string", "enum": ["json", "form"]},
{"type": "null"},
],
"description": "Content type for webhook payload",
},
"secret": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"description": "Secret for webhook signature verification",
},
"active": {
"anyOf": [{"type": "boolean"}, {"type": "null"}],
"description": "Activate or deactivate webhook",
},
},
"required": ["owner", "repo", "webhook_id"],
},
"scope": "admin",
},
]
@@ -220,3 +293,40 @@ async def get_webhook(client: GiteaClient, owner: str, repo: str, webhook_id: in
webhook = await client.get_webhook(owner, repo, webhook_id)
result = {"success": True, "webhook": webhook}
return json.dumps(result, indent=2)
async def update_webhook(
client: GiteaClient,
owner: str,
repo: str,
webhook_id: int,
url: str | None = None,
events: list[str] | None = None,
content_type: str | None = None,
secret: str | None = None,
active: bool | None = None,
) -> str:
"""Update a webhook"""
data: dict = {}
if events is not None:
data["events"] = events
if active is not None:
data["active"] = active
config: dict = {}
if url is not None:
config["url"] = url
if content_type is not None:
config["content_type"] = content_type
if secret is not None:
config["secret"] = secret
if config:
data["config"] = config
webhook = await client.update_webhook(owner, repo, webhook_id, data)
result = {
"success": True,
"message": f"Webhook {webhook_id} updated successfully",
"webhook": webhook,
}
return json.dumps(result, indent=2)