From a0484dcaaa61e068b23d94d61a4ee34bc5da5cde Mon Sep 17 00:00:00 2001 From: mpmedia Date: Sun, 24 May 2026 23:58:15 -0500 Subject: [PATCH] Add skills/gitea/references/webhooks.md --- skills/gitea/references/webhooks.md | 104 ++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 skills/gitea/references/webhooks.md diff --git a/skills/gitea/references/webhooks.md b/skills/gitea/references/webhooks.md new file mode 100644 index 0000000..0d913d5 --- /dev/null +++ b/skills/gitea/references/webhooks.md @@ -0,0 +1,104 @@ +# Webhooks API reference + +Base: `https://git.mpm.to/api/v1` + +Gitea supports webhooks at the repository and organization level. + +## List webhooks for a repository + +```bash +curl -s -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \ + "https://git.mpm.to/api/v1/repos/{owner}/{repo}/hooks" +``` + +Key response fields per hook: `id`, `type`, `active`, `events`, `config.url`, `config.content_type`, `created`, `updated`. + +## Get a single webhook + +```bash +curl -s -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \ + "https://git.mpm.to/api/v1/repos/{owner}/{repo}/hooks/{id}" +``` + +## Create a webhook on a repository + +```bash +curl -s -X POST \ + -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \ + -H "Content-Type: application/json" \ + -d '{ + "type": "gitea", + "active": true, + "events": ["push", "issues", "pull_request", "release"], + "config": { + "url": "https://your-endpoint.example.com/webhook", + "content_type": "json", + "secret": "optional-secret" + } + }' \ + "https://git.mpm.to/api/v1/repos/{owner}/{repo}/hooks" +``` + +Common event types: +- `push` — commits pushed to any branch +- `create` — branch or tag created +- `delete` — branch or tag deleted +- `fork` — repo forked +- `issues` — issue opened/edited/closed/reopened +- `issue_comment` — comment on an issue +- `pull_request` — PR opened/edited/closed/merged +- `pull_request_review` — PR review submitted +- `release` — release published +- `repository` — repo created/deleted/made public or private + +## Update a webhook + +```bash +curl -s -X PATCH \ + -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \ + -H "Content-Type: application/json" \ + -d '{ + "active": true, + "events": ["push", "release"], + "config": { + "url": "https://your-endpoint.example.com/webhook", + "content_type": "json" + } + }' \ + "https://git.mpm.to/api/v1/repos/{owner}/{repo}/hooks/{id}" +``` + +## Delete a webhook + +```bash +curl -s -X DELETE \ + -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \ + "https://git.mpm.to/api/v1/repos/{owner}/{repo}/hooks/{id}" +``` + +Always confirm before deleting a webhook. + +## Test a webhook (trigger a ping) + +```bash +curl -s -X POST \ + -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \ + "https://git.mpm.to/api/v1/repos/{owner}/{repo}/hooks/{id}/tests" +``` + +## Organization-level webhooks + +Same endpoints, but under `/orgs/{org}/hooks` instead of `/repos/{owner}/{repo}/hooks`. + +```bash +# List org webhooks +curl -s -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \ + "https://git.mpm.to/api/v1/orgs/{org}/hooks" + +# Create org webhook +curl -s -X POST \ + -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \ + -H "Content-Type: application/json" \ + -d '{"type":"gitea","active":true,"events":["push"],"config":{"url":"https://...","content_type":"json"}}' \ + "https://git.mpm.to/api/v1/orgs/{org}/hooks" +```