--- name: gitea_create_webhook kind: function lang: bash domain: infra version: "1.0.0" purity: impure signature: "gitea_create_webhook(owner: string, repo: string, target_url: string, secret?: string) -> json" description: "Crea un webhook de push en un repositorio Gitea. El webhook notifica a target_url en cada push." tags: [gitea, webhook, push, deploy, ci, infra, pendiente-usar] uses_functions: [] uses_types: [] returns: [] returns_optional: false error_type: "error_go_core" imports: [] params: - name: owner desc: "usuario u organización propietaria del repositorio" - name: repo desc: "nombre del repositorio" - name: target_url desc: "URL que recibirá el POST del webhook en cada push" - name: secret desc: "secreto compartido para firmar el payload (opcional)" output: "JSON con webhook_id, owner, repo, target_url" tested: false tests: [] test_file_path: "" file_path: "bash/functions/infra/gitea_create_webhook.sh" --- ## Ejemplo ```bash source bash/functions/infra/gitea_create_webhook.sh export GITEA_URL="https://git.example.com" export GITEA_TOKEN="$(pass agentes/dataforge-token)" # Crear webhook para auto-deploy gitea_create_webhook "myorg" "dag_engine" "http://vps:9090/webhook/push" "mi_secreto" # {"webhook_id":42,"owner":"myorg","repo":"dag_engine","target_url":"http://vps:9090/webhook/push"} ``` ## Notas - Requiere `GITEA_URL` y `GITEA_TOKEN` como variables de entorno. - Solo escucha eventos `push`. Para otros eventos, modificar el array `events` en el payload. - Si el webhook ya existe para la misma URL, Gitea crea uno duplicado (no es idempotente).