# tuna и GitVerse

GitVerse позволяет добавлять в проектах [Webhook](https://gitverse.ru/docs/developers/webhooks/) – ссылки на которые будут отправляться сообщения об определенных событиях, например, о добавлении комментария.

## Шаг 1. Скачайте клиент

Instructions are available on the [installation page](https://tuna.am/en/docs/guides/install.md).

## Шаг 2. Запустите сервер для обработки событий от GitVerse

Пример входящего события

Заголовки:

```js
{
"Content-Type": "application/json",
"X-GitHub-Delivery": "0218f02f-cfb6-42d5-a08c-3c2709442b0a",
"X-GitHub-Event": "push",
"X-GitHub-Event-Type": "push",
"X-Gitverse-Delivery": "0218f02f-cfb6-42d5-a08c-3c2709442b0a",
"X-Gitverse-Event": "push",
"X-Gitverse-Event-Type": "push",
"X-Gitverse-Signature": "",
"X-Gogs-Delivery": "0218f02f-cfb6-42d5-a08c-3c2709442b0a",
"X-Gogs-Event": "push",
"X-Gogs-Event-Type": "push",
"X-Gogs-Signature": "",
"X-Hub-Signature": "sha1=",
"X-Hub-Signature-256": "sha256="
}

```

Тело запроса:

```js
{
"ref": "refs/heads/master",
"before": "0000000000000000000000000000000000000000",
"after": "990564d83c961519f581e8c539f30aa101ffbaa0",
"compare_url": "https://gitverse.ru/",
"commits": [
  {
    "id": "990564d83c961519f581e8c539f30aa101ffbaa0",
    "message": "create: new_file\n",
    "url": "https://gitverse.ru/leoderoko/tuna-webhook-test/commit/990564d83c961519f581e8c539f30aa101ffbaa0",
    "author": {
      "name": "leoderoko",
      "email": "193755leoderoko@users.no-reply.gitverse.ru",
      "username": ""
    },
    "committer": {
      "name": "GitVerse",
      "email": "noreply@gitverse.ru",
      "username": ""
    },
    "verification": null,
    "timestamp": "2026-04-28T05:19:19Z",
    "added": [
      "new_file"
    ],
    "removed": [],
    "modified": []
  }
],
"total_commits": 1,
"head_commit": {
  "id": "990564d83c961519f581e8c539f30aa101ffbaa0",
  "message": "create: new_file",
  "url": "https://gitverse.ru/leoderoko/tuna-webhook-test/commit/990564d83c961519f581e8c539f30aa101ffbaa0",
  "author": {
    "name": "leoderoko",
    "email": "193755leoderoko@users.no-reply.gitverse.ru",
    "username": ""
  },
  "committer": {
    "name": "GitVerse",
    "email": "noreply@gitverse.ru",
    "username": ""
  },
  "verification": null,
  "timestamp": "2026-04-28T05:19:19Z",
  "added": [
    "new_file"
  ],
  "removed": [],
  "modified": []
},
"repository": {
  "id": 250007,
  "owner": {
    "id": 193755,
    "login": "leoderoko",
    "login_name": "",
    "source_id": 0,
    "full_name": "",
    "email": "193755leoderoko@users.no-reply.gitverse.ru",
    "avatar_url": "https://gitverse.ru/avatars/9fc126f12ab01cadf5a370c07e92c23e",
    "html_url": "https://gitverse.ru/leoderoko",
    "language": "",
    "is_admin": false,
    "last_login": "0001-01-01T00:00:00Z",
    "created": "2026-02-07T17:44:11Z",
    "restricted": false,
    "active": false,
    "prohibit_login": false,
    "location": "",
    "website": "",
    "description": "",
    "visibility": "public",
    "followers_count": 0,
    "following_count": 0,
    "starred_repos_count": 0,
    "username": "leoderoko"
  },
  "name": "tuna-webhook-test",
  "full_name": "leoderoko/tuna-webhook-test",
  "description": "",
  "empty": false,
  "private": true,
  "fork": false,
  "template": false,
  "parent": null,
  "mirror": false,
  "size": 22,
  "language": "",
  "languages_url": "http://gitverse-backend-http:3000/api/v1/repos/leoderoko/tuna-webhook-test/languages",
  "html_url": "http://gitverse-backend-http:3000/leoderoko/tuna-webhook-test",
  "url": "http://gitverse-backend-http:3000/api/v1/repos/leoderoko/tuna-webhook-test",
  "link": "",
  "ssh_url": "git@gitverse.ru:leoderoko/tuna-webhook-test.git",
  "clone_url": "https://gitverse.ru/leoderoko/tuna-webhook-test.git",
  "original_url": "",
  "website": "",
  "stars_count": 0,
  "forks_count": 0,
  "watchers_count": 0,
  "open_issues_count": 0,
  "open_pr_counter": 0,
  "release_counter": 0,
  "default_branch": "master",
  "archived": false,
  "created_at": "2026-04-28T05:09:11Z",
  "updated_at": "2026-04-28T05:19:21Z",
  "archived_at": "1970-01-01T00:00:00Z",
  "permissions": {
    "admin": true,
    "push": true,
    "pull": true
  },
  "has_issues": false,
  "has_wiki": false,
  "has_pull_requests": true,
  "has_projects": false,
  "projects_mode": "all",
  "has_releases": true,
  "has_packages": false,
  "has_actions": true,
  "ignore_whitespace_conflicts": false,
  "allow_merge_commits": true,
  "allow_rebase": true,
  "allow_rebase_explicit": true,
  "allow_squash_merge": true,
  "allow_fast_forward_only_merge": true,
  "allow_rebase_update": true,
  "default_delete_branch_after_merge": false,
  "default_merge_style": "merge",
  "default_allow_maintainer_edit": false,
  "avatar_url": "",
  "internal": false,
  "mirror_interval": "",
  "object_format_name": "sha1",
  "mirror_updated": "0001-01-01T00:00:00Z",
  "repo_transfer": null,
  "topics": [],
  "licenses": null
},
"pusher": {
  "id": 193755,
  "login": "leoderoko",
  "login_name": "",
  "source_id": 0,
  "full_name": "",
  "email": "193755leoderoko@users.no-reply.gitverse.ru",
  "avatar_url": "https://gitverse.ru/avatars/9fc126f12ab01cadf5a370c07e92c23e",
  "html_url": "https://gitverse.ru/leoderoko",
  "language": "",
  "is_admin": false,
  "last_login": "0001-01-01T00:00:00Z",
  "created": "2026-02-07T17:44:11Z",
  "restricted": false,
  "active": false,
  "prohibit_login": false,
  "location": "",
  "website": "",
  "description": "",
  "visibility": "public",
  "followers_count": 0,
  "following_count": 0,
  "starred_repos_count": 0,
  "username": "leoderoko"
},
"sender": {
  "id": 193755,
  "login": "leoderoko",
  "login_name": "",
  "source_id": 0,
  "full_name": "",
  "email": "193755leoderoko@users.no-reply.gitverse.ru",
  "avatar_url": "https://gitverse.ru/avatars/9fc126f12ab01cadf5a370c07e92c23e",
  "html_url": "https://gitverse.ru/leoderoko",
  "language": "",
  "is_admin": false,
  "last_login": "0001-01-01T00:00:00Z",
  "created": "2026-02-07T17:44:11Z",
  "restricted": false,
  "active": false,
  "prohibit_login": false,
  "location": "",
  "website": "",
  "description": "",
  "visibility": "public",
  "followers_count": 0,
  "following_count": 0,
  "starred_repos_count": 0,
  "username": "leoderoko"
}
}

```

## Шаг 3. Запустите tuna

В аргументах запуска укажите порт вашего сервера:

```bash
tuna http 8080

```

Или с указанием статичного адреса:

```bash
tuna http 8080 --subdomain=gitverse-webhook

```

## Шаг 4. Создайте новый Webhook

Перейдите в раздел Вебхуки настроек проекта, укажите адрес входящий сообщений и укажите события, которые хотиле получать: ![gitverse](/en/assets/images/gitverse1-bd5131d750b8a4e9b8072866fad04da3.png) URL состоит из адреса полученного от tuna (например, `https://gitverse-webhook.ru.tuna.am`) и пути к методу вашего сервера для обработки событий (например, `/event`).
