snapshot of https://github.com/zulip/zulip.git @ 48c69911c7dd4e03b20552eb3bd77ad8151c1357 (2026-09-15)
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled

This commit is contained in:
upstream-mirror
2026-09-15 15:05:30 +05:00
commit 64898b2c79
8999 changed files with 1757358 additions and 0 deletions

View File

View File

@@ -0,0 +1,29 @@
# Zulip Gogs integration
Receive Gogs notifications in Zulip!
{start_tabs}
1. {!create-an-incoming-webhook.md!}
1. {!generate-webhook-url-with-branch-filtering.md!}
1. Go to your repository on Gogs and click on **Settings**. Select
**Webhooks** on the left sidebar, and click **Add Webhook**.
Select **Gogs**.
1. Set **Payload URL** to the URL generated above. Set **Content type**
to `application/json`. Select the [events](#filtering-incoming-events)
you would like to receive notifications for, and click **Add Webhook**.
{end_tabs}
{!congrats.md!}
![](/static/images/integrations/gogs/001.png)
{!event-filtering-additional-feature.md!}
### Related documentation
{!webhooks-url-specification.md!}

View File

@@ -0,0 +1,40 @@
{
"secret": "",
"ref": "my_feature",
"ref_type": "branch",
"repository": {
"id": 1,
"owner": {
"id": 1,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/715cb4680284423d81d2e75e94f812a1",
"username": "john"
},
"name": "try-git",
"full_name": "john/try-git",
"description": "",
"private": false,
"fork": false,
"html_url": "http://localhost:3000/john/try-git",
"ssh_url": "john@localhost:john/try-git.git",
"clone_url": "http://localhost:3000/john/try-git.git",
"website": "",
"stars_count": 0,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 0,
"default_branch": "master",
"created_at": "2017-02-19T13:23:39-05:00",
"updated_at": "2017-02-19T13:57:06-05:00"
},
"sender": {
"id": 1,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/715cb4680284423d81d2e75e94f812a1",
"username": "john"
}
}

View File

@@ -0,0 +1,91 @@
{
"action": "edited",
"issue": {
"id": 5267,
"number": 3,
"user": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"title": "New test issue",
"body": "Test",
"labels": [],
"milestone": null,
"assignee": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"state": "open",
"comments": 2,
"created_at": "2019-11-17T20:50:48Z",
"updated_at": "2019-11-17T23:01:06Z",
"pull_request": null
},
"comment": {
"id": 3634,
"html_url": "https://try.gogs.io/kostekIV/test/issues/3#issuecomment-3634",
"user": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"body": "edit comment",
"created_at": "2019-11-17T20:51:01Z",
"updated_at": "2019-11-17T20:51:01Z"
},
"changes": {
"body": {
"from": "comment"
}
},
"repository": {
"id": 23925,
"owner": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"name": "test",
"full_name": "kostekIV/test",
"description": "",
"private": false,
"fork": false,
"parent": null,
"empty": false,
"mirror": false,
"size": 49152,
"html_url": "https://try.gogs.io/kostekIV/test",
"ssh_url": "git@try.gogs.io:kostekIV/test.git",
"clone_url": "https://try.gogs.io/kostekIV/test.git",
"website": "",
"stars_count": 1,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 2,
"default_branch": "master",
"created_at": "2019-11-16T08:08:03Z",
"updated_at": "2019-11-17T23:18:17Z"
},
"sender": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
}
}

View File

@@ -0,0 +1,79 @@
{
"action": "created",
"issue": {
"id": 5267,
"number": 3,
"user": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"title": "New test issue",
"body": "Closing",
"labels": [],
"milestone": null,
"assignee": null,
"state": "open",
"comments": 1,
"created_at": "2019-11-17T20:50:48Z",
"updated_at": "2019-11-17T20:51:01Z",
"pull_request": null
},
"comment": {
"id": 3635,
"html_url": "https://try.gogs.io/kostekIV/test/issues/3#issuecomment-3635",
"user": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"body": "Test comment",
"created_at": "0001-01-01T00:00:00Z",
"updated_at": "0001-01-01T00:00:00Z"
},
"repository": {
"id": 23925,
"owner": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"name": "test",
"full_name": "kostekIV/test",
"description": "",
"private": false,
"fork": false,
"parent": null,
"empty": false,
"mirror": false,
"size": 40960,
"html_url": "https://try.gogs.io/kostekIV/test",
"ssh_url": "git@try.gogs.io:kostekIV/test.git",
"clone_url": "https://try.gogs.io/kostekIV/test.git",
"website": "",
"stars_count": 0,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 1,
"default_branch": "master",
"created_at": "2019-11-16T08:08:03Z",
"updated_at": "2019-11-16T08:12:33Z"
},
"sender": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
}
}

View File

@@ -0,0 +1,72 @@
{
"action": "assigned",
"number": 3,
"issue": {
"id": 5267,
"number": 3,
"user": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"title": "New test issue",
"body": "Test",
"labels": [],
"milestone": null,
"assignee": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"state": "open",
"comments": 2,
"created_at": "2019-11-17T20:50:48Z",
"updated_at": "2019-11-17T22:59:12Z",
"pull_request": null
},
"repository": {
"id": 23925,
"owner": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"name": "test",
"full_name": "kostekIV/test",
"description": "",
"private": false,
"fork": false,
"parent": null,
"empty": false,
"mirror": false,
"size": 40960,
"html_url": "https://try.gogs.io/kostekIV/test",
"ssh_url": "git@try.gogs.io:kostekIV/test.git",
"clone_url": "https://try.gogs.io/kostekIV/test.git",
"website": "",
"stars_count": 0,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 2,
"default_branch": "master",
"created_at": "2019-11-16T08:08:03Z",
"updated_at": "2019-11-16T08:12:33Z"
},
"sender": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
}
}

View File

@@ -0,0 +1,65 @@
{
"action": "closed",
"number": 3,
"issue": {
"id": 5267,
"number": 3,
"user": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"title": "New test issue",
"body": "Closed #3",
"labels": [],
"milestone": null,
"assignee": null,
"state": "closed",
"comments": 1,
"created_at": "2019-11-17T20:50:48Z",
"updated_at": "2019-11-17T20:51:01Z",
"pull_request": null
},
"repository": {
"id": 23925,
"owner": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"name": "test",
"full_name": "kostekIV/test",
"description": "",
"private": false,
"fork": false,
"parent": null,
"empty": false,
"mirror": false,
"size": 40960,
"html_url": "https://try.gogs.io/kostekIV/test",
"ssh_url": "git@try.gogs.io:kostekIV/test.git",
"clone_url": "https://try.gogs.io/kostekIV/test.git",
"website": "",
"stars_count": 0,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 1,
"default_branch": "master",
"created_at": "2019-11-16T08:08:03Z",
"updated_at": "2019-11-16T08:12:33Z"
},
"sender": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
}
}

View File

@@ -0,0 +1,70 @@
{
"action": "edited",
"number": 3,
"issue": {
"id": 5268,
"number": 3,
"user": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"title": "New test issue",
"body": "Test edit",
"labels": [],
"milestone": null,
"assignee": null,
"state": "open",
"comments": 0,
"created_at": "2019-11-17T21:52:57Z",
"updated_at": "2019-11-17T21:52:57Z",
"pull_request": null
},
"changes": {
"body": {
"from": ""
}
},
"repository": {
"id": 23925,
"owner": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"name": "test",
"full_name": "kostekIV/test",
"description": "",
"private": false,
"fork": false,
"parent": null,
"empty": false,
"mirror": false,
"size": 40960,
"html_url": "https://try.gogs.io/kostekIV/test",
"ssh_url": "git@try.gogs.io:kostekIV/test.git",
"clone_url": "https://try.gogs.io/kostekIV/test.git",
"website": "",
"stars_count": 0,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 1,
"default_branch": "master",
"created_at": "2019-11-16T08:08:03Z",
"updated_at": "2019-11-16T08:12:33Z"
},
"sender": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
}
}

View File

@@ -0,0 +1,65 @@
{
"action": "opened",
"number": 3,
"issue": {
"id": 5267,
"number": 3,
"user": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"title": "New test issue",
"body": "Test",
"labels": [],
"milestone": null,
"assignee": null,
"state": "open",
"comments": 0,
"created_at": "0001-01-01T00:00:00Z",
"updated_at": "0001-01-01T00:00:00Z",
"pull_request": null
},
"repository": {
"id": 23925,
"owner": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"name": "test",
"full_name": "kostekIV/test",
"description": "",
"private": false,
"fork": false,
"parent": null,
"empty": false,
"mirror": false,
"size": 40960,
"html_url": "https://try.gogs.io/kostekIV/test",
"ssh_url": "git@try.gogs.io:kostekIV/test.git",
"clone_url": "https://try.gogs.io/kostekIV/test.git",
"website": "",
"stars_count": 0,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 0,
"default_branch": "master",
"created_at": "2019-11-16T08:08:03Z",
"updated_at": "2019-11-16T08:12:33Z"
},
"sender": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
}
}

View File

@@ -0,0 +1,65 @@
{
"action": "reopened",
"number": 3,
"issue": {
"id": 5267,
"number": 3,
"user": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"title": "New test issue",
"body": "Test",
"labels": [],
"milestone": null,
"assignee": null,
"state": "open",
"comments": 2,
"created_at": "2019-11-17T20:50:48Z",
"updated_at": "2019-11-17T20:51:06Z",
"pull_request": null
},
"repository": {
"id": 23925,
"owner": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"name": "test",
"full_name": "kostekIV/test",
"description": "",
"private": false,
"fork": false,
"parent": null,
"empty": false,
"mirror": false,
"size": 40960,
"html_url": "https://try.gogs.io/kostekIV/test",
"ssh_url": "git@try.gogs.io:kostekIV/test.git",
"clone_url": "https://try.gogs.io/kostekIV/test.git",
"website": "",
"stars_count": 0,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 1,
"default_branch": "master",
"created_at": "2019-11-16T08:08:03Z",
"updated_at": "2019-11-16T08:12:33Z"
},
"sender": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
}
}

View File

@@ -0,0 +1,139 @@
{
"action": "assigned",
"number": 2,
"pull_request": {
"id": 1349,
"number": 2,
"user": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"title": "Test",
"body": "",
"labels": [],
"milestone": null,
"assignee": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"state": "open",
"comments": 3,
"head_branch": "c",
"head_repo": {
"id": 23925,
"owner": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"name": "test",
"full_name": "kostekIV/test",
"description": "",
"private": false,
"fork": false,
"parent": null,
"empty": false,
"mirror": false,
"size": 40960,
"html_url": "https://try.gogs.io/kostekIV/test",
"ssh_url": "git@try.gogs.io:kostekIV/test.git",
"clone_url": "https://try.gogs.io/kostekIV/test.git",
"website": "",
"stars_count": 1,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 2,
"default_branch": "master",
"created_at": "2019-11-16T08:08:03Z",
"updated_at": "2019-11-16T08:12:33Z"
},
"base_branch": "master",
"base_repo": {
"id": 23925,
"owner": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"name": "test",
"full_name": "kostekIV/test",
"description": "",
"private": false,
"fork": false,
"parent": null,
"empty": false,
"mirror": false,
"size": 40960,
"html_url": "https://try.gogs.io/kostekIV/test",
"ssh_url": "git@try.gogs.io:kostekIV/test.git",
"clone_url": "https://try.gogs.io/kostekIV/test.git",
"website": "",
"stars_count": 1,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 2,
"default_branch": "master",
"created_at": "2019-11-16T08:08:03Z",
"updated_at": "2019-11-16T08:12:33Z"
},
"html_url": "https://try.gogs.io/kostekIV/test/pulls/2",
"mergeable": false,
"merged": false,
"merged_at": null,
"merge_commit_sha": null,
"merged_by": null
},
"repository": {
"id": 23925,
"owner": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"name": "test",
"full_name": "kostekIV/test",
"description": "",
"private": false,
"fork": false,
"parent": null,
"empty": false,
"mirror": false,
"size": 40960,
"html_url": "https://try.gogs.io/kostekIV/test",
"ssh_url": "git@try.gogs.io:kostekIV/test.git",
"clone_url": "https://try.gogs.io/kostekIV/test.git",
"website": "",
"stars_count": 1,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 2,
"default_branch": "master",
"created_at": "2019-11-16T08:08:03Z",
"updated_at": "2019-11-16T08:12:33Z"
},
"sender": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
}
}

View File

@@ -0,0 +1,121 @@
{
"secret": "",
"action": "closed",
"number": 1,
"pull_request": {
"id": 1,
"number": 1,
"user": {
"id": 2,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/3e55b4d0f779dd3b7ab3be7960dc157a",
"username": "john"
},
"title": "Title Text for Pull Request",
"body": "Description Text",
"labels": [],
"milestone": null,
"assignee": null,
"state": "closed",
"comments": 0,
"head_branch": "feature",
"head_repo": {
"id": 2,
"owner": {
"id": 2,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/3e55b4d0f779dd3b7ab3be7960dc157a",
"username": "john"
},
"name": "try-git",
"full_name": "john/try-git",
"description": "",
"private": false,
"fork": true,
"html_url": "http://localhost:3000/john/try-git",
"ssh_url": "john@localhost:john/try-git.git",
"clone_url": "http://localhost:3000/john/try-git.git",
"website": "",
"stars_count": 0,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 0,
"default_branch": "master",
"created_at": "2017-02-19T18:10:53-05:00",
"updated_at": "2017-02-19T18:13:08-05:00"
},
"base_branch": "master",
"base_repo": {
"id": 1,
"owner": {
"id": 1,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/715cb4680284423d81d2e75e94f812a1",
"username": "john"
},
"name": "try-git",
"full_name": "john/try-git",
"description": "",
"private": false,
"fork": false,
"html_url": "http://localhost:3000/john/try-git",
"ssh_url": "john@localhost:john/try-git.git",
"clone_url": "http://localhost:3000/john/try-git.git",
"website": "",
"stars_count": 0,
"forks_count": 1,
"watchers_count": 1,
"open_issues_count": 0,
"default_branch": "master",
"created_at": "2017-02-19T13:23:39-05:00",
"updated_at": "2017-02-19T17:56:41-05:00"
},
"html_url": "http://localhost:3000/john/try-git/pulls/1",
"mergeable": true,
"merged": false,
"merged_at": null,
"merge_commit_sha": null,
"merged_by": null
},
"repository": {
"id": 1,
"owner": {
"id": 1,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/715cb4680284423d81d2e75e94f812a1",
"username": "john"
},
"name": "try-git",
"full_name": "john/try-git",
"description": "",
"private": false,
"fork": false,
"html_url": "http://localhost:3000/john/try-git",
"ssh_url": "john@localhost:john/try-git.git",
"clone_url": "http://localhost:3000/john/try-git.git",
"website": "",
"stars_count": 0,
"forks_count": 1,
"watchers_count": 1,
"open_issues_count": 0,
"default_branch": "master",
"created_at": "2017-02-19T13:23:39-05:00",
"updated_at": "2017-02-19T17:56:41-05:00"
},
"sender": {
"id": 1,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/715cb4680284423d81d2e75e94f812a1",
"username": "john"
}
}

View File

@@ -0,0 +1,137 @@
{
"action": "edited",
"number": 2,
"pull_request": {
"id": 1349,
"number": 2,
"user": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"title": "Test",
"body": "",
"labels": [],
"milestone": null,
"assignee": null,
"state": "open",
"comments": 3,
"head_branch": "c",
"head_repo": {
"id": 23925,
"owner": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"name": "test",
"full_name": "kostekIV/test",
"description": "",
"private": false,
"fork": false,
"parent": null,
"empty": false,
"mirror": false,
"size": 40960,
"html_url": "https://try.gogs.io/kostekIV/test",
"ssh_url": "git@try.gogs.io:kostekIV/test.git",
"clone_url": "https://try.gogs.io/kostekIV/test.git",
"website": "",
"stars_count": 0,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 2,
"default_branch": "master",
"created_at": "2019-11-16T08:08:03Z",
"updated_at": "2019-11-16T08:12:33Z"
},
"base_branch": "master",
"base_repo": {
"id": 23925,
"owner": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"name": "test",
"full_name": "kostekIV/test",
"description": "",
"private": false,
"fork": false,
"parent": null,
"empty": false,
"mirror": false,
"size": 40960,
"html_url": "https://try.gogs.io/kostekIV/test",
"ssh_url": "git@try.gogs.io:kostekIV/test.git",
"clone_url": "https://try.gogs.io/kostekIV/test.git",
"website": "",
"stars_count": 0,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 2,
"default_branch": "master",
"created_at": "2019-11-16T08:08:03Z",
"updated_at": "2019-11-16T08:12:33Z"
},
"html_url": "https://try.gogs.io/kostekIV/test/pulls/2",
"mergeable": false,
"merged": false,
"merged_at": null,
"merge_commit_sha": null,
"merged_by": null
},
"changes": {
"title": {
"from": "23r"
}
},
"repository": {
"id": 23925,
"owner": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"name": "test",
"full_name": "kostekIV/test",
"description": "",
"private": false,
"fork": false,
"parent": null,
"empty": false,
"mirror": false,
"size": 40960,
"html_url": "https://try.gogs.io/kostekIV/test",
"ssh_url": "git@try.gogs.io:kostekIV/test.git",
"clone_url": "https://try.gogs.io/kostekIV/test.git",
"website": "",
"stars_count": 0,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 2,
"default_branch": "master",
"created_at": "2019-11-16T08:08:03Z",
"updated_at": "2019-11-16T08:12:33Z"
},
"sender": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
}
}

View File

@@ -0,0 +1,128 @@
{
"secret": "",
"action": "closed",
"number": 2,
"pull_request": {
"id": 2,
"number": 2,
"user": {
"id": 2,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/3e55b4d0f779dd3b7ab3be7960dc157a",
"username": "john"
},
"title": "Title Text for Pull Request",
"body": "Description Text",
"labels": [],
"milestone": null,
"assignee": null,
"state": "closed",
"comments": 0,
"head_branch": "feature",
"head_repo": {
"id": 2,
"owner": {
"id": 2,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/3e55b4d0f779dd3b7ab3be7960dc157a",
"username": "john"
},
"name": "try-git",
"full_name": "john/try-git",
"description": "",
"private": false,
"fork": true,
"html_url": "http://localhost:3000/john/try-git",
"ssh_url": "john@localhost:john/try-git.git",
"clone_url": "http://localhost:3000/john/try-git.git",
"website": "",
"stars_count": 0,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 0,
"default_branch": "master",
"created_at": "2017-02-19T18:10:53-05:00",
"updated_at": "2017-02-19T18:19:27-05:00"
},
"base_branch": "master",
"base_repo": {
"id": 1,
"owner": {
"id": 1,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/715cb4680284423d81d2e75e94f812a1",
"username": "john"
},
"name": "try-git",
"full_name": "john/try-git",
"description": "",
"private": false,
"fork": false,
"html_url": "http://localhost:3000/john/try-git",
"ssh_url": "john@localhost:john/try-git.git",
"clone_url": "http://localhost:3000/john/try-git.git",
"website": "",
"stars_count": 0,
"forks_count": 1,
"watchers_count": 1,
"open_issues_count": 0,
"default_branch": "master",
"created_at": "2017-02-19T13:23:39-05:00",
"updated_at": "2017-02-19T17:56:41-05:00"
},
"html_url": "http://localhost:3000/john/try-git/pulls/2",
"mergeable": true,
"merged": true,
"merged_at": "2017-02-19T18:20:24.851356231-05:00",
"merge_commit_sha": "9c65fc6e0a3a7487ad70a3711c8c478aa6e94c69",
"merged_by": {
"id": 1,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/715cb4680284423d81d2e75e94f812a1",
"username": "john"
}
},
"repository": {
"id": 1,
"owner": {
"id": 1,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/715cb4680284423d81d2e75e94f812a1",
"username": "john"
},
"name": "try-git",
"full_name": "john/try-git",
"description": "",
"private": false,
"fork": false,
"html_url": "http://localhost:3000/john/try-git",
"ssh_url": "john@localhost:john/try-git.git",
"clone_url": "http://localhost:3000/john/try-git.git",
"website": "",
"stars_count": 0,
"forks_count": 1,
"watchers_count": 1,
"open_issues_count": 0,
"default_branch": "master",
"created_at": "2017-02-19T13:23:39-05:00",
"updated_at": "2017-02-19T17:56:41-05:00"
},
"sender": {
"id": 1,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/715cb4680284423d81d2e75e94f812a1",
"username": "john"
}
}

View File

@@ -0,0 +1,121 @@
{
"secret": "",
"action": "opened",
"number": 1,
"pull_request": {
"id": 1,
"number": 1,
"user": {
"id": 2,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/3e55b4d0f779dd3b7ab3be7960dc157a",
"username": "john"
},
"title": "Title Text for Pull Request",
"body": "Description Text",
"labels": [],
"milestone": null,
"assignee": null,
"state": "open",
"comments": 0,
"head_branch": "feature",
"head_repo": {
"id": 2,
"owner": {
"id": 2,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/3e55b4d0f779dd3b7ab3be7960dc157a",
"username": "john"
},
"name": "try-git",
"full_name": "john/try-git",
"description": "",
"private": false,
"fork": true,
"html_url": "http://localhost:3000/john/try-git",
"ssh_url": "john@localhost:john/try-git.git",
"clone_url": "http://localhost:3000/john/try-git.git",
"website": "",
"stars_count": 0,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 0,
"default_branch": "master",
"created_at": "2017-02-19T18:10:53-05:00",
"updated_at": "2017-02-19T18:13:08-05:00"
},
"base_branch": "master",
"base_repo": {
"id": 1,
"owner": {
"id": 1,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/715cb4680284423d81d2e75e94f812a1",
"username": "john"
},
"name": "try-git",
"full_name": "john/try-git",
"description": "",
"private": false,
"fork": false,
"html_url": "http://localhost:3000/john/try-git",
"ssh_url": "john@localhost:john/try-git.git",
"clone_url": "http://localhost:3000/john/try-git.git",
"website": "",
"stars_count": 0,
"forks_count": 1,
"watchers_count": 1,
"open_issues_count": 0,
"default_branch": "master",
"created_at": "2017-02-19T13:23:39-05:00",
"updated_at": "2017-02-19T17:56:41-05:00"
},
"html_url": "http://localhost:3000/john/try-git/pulls/1",
"mergeable": true,
"merged": false,
"merged_at": null,
"merge_commit_sha": null,
"merged_by": null
},
"repository": {
"id": 1,
"owner": {
"id": 1,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/715cb4680284423d81d2e75e94f812a1",
"username": "john"
},
"name": "try-git",
"full_name": "john/try-git",
"description": "",
"private": false,
"fork": false,
"html_url": "http://localhost:3000/john/try-git",
"ssh_url": "john@localhost:john/try-git.git",
"clone_url": "http://localhost:3000/john/try-git.git",
"website": "",
"stars_count": 0,
"forks_count": 1,
"watchers_count": 1,
"open_issues_count": 0,
"default_branch": "master",
"created_at": "2017-02-19T13:23:39-05:00",
"updated_at": "2017-02-19T17:56:41-05:00"
},
"sender": {
"id": 2,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/3e55b4d0f779dd3b7ab3be7960dc157a",
"username": "john"
}
}

View File

@@ -0,0 +1,132 @@
{
"action": "reopened",
"number": 2,
"pull_request": {
"id": 1349,
"number": 2,
"user": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"title": "reopened",
"body": "",
"labels": [],
"milestone": null,
"assignee": null,
"state": "open",
"comments": 2,
"head_branch": "c",
"head_repo": {
"id": 23925,
"owner": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"name": "test",
"full_name": "kostekIV/test",
"description": "",
"private": false,
"fork": false,
"parent": null,
"empty": false,
"mirror": false,
"size": 40960,
"html_url": "https://try.gogs.io/kostekIV/test",
"ssh_url": "git@try.gogs.io:kostekIV/test.git",
"clone_url": "https://try.gogs.io/kostekIV/test.git",
"website": "",
"stars_count": 0,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 0,
"default_branch": "master",
"created_at": "2019-11-16T08:08:03Z",
"updated_at": "2019-11-16T08:12:33Z"
},
"base_branch": "master",
"base_repo": {
"id": 23925,
"owner": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"name": "test",
"full_name": "kostekIV/test",
"description": "",
"private": false,
"fork": false,
"parent": null,
"empty": false,
"mirror": false,
"size": 40960,
"html_url": "https://try.gogs.io/kostekIV/test",
"ssh_url": "git@try.gogs.io:kostekIV/test.git",
"clone_url": "https://try.gogs.io/kostekIV/test.git",
"website": "",
"stars_count": 0,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 0,
"default_branch": "master",
"created_at": "2019-11-16T08:08:03Z",
"updated_at": "2019-11-16T08:12:33Z"
},
"html_url": "https://try.gogs.io/kostekIV/test/pulls/2",
"mergeable": null,
"merged": false,
"merged_at": null,
"merge_commit_sha": null,
"merged_by": null
},
"repository": {
"id": 23925,
"owner": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"name": "test",
"full_name": "kostekIV/test",
"description": "",
"private": false,
"fork": false,
"parent": null,
"empty": false,
"mirror": false,
"size": 40960,
"html_url": "https://try.gogs.io/kostekIV/test",
"ssh_url": "git@try.gogs.io:kostekIV/test.git",
"clone_url": "https://try.gogs.io/kostekIV/test.git",
"website": "",
"stars_count": 0,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 0,
"default_branch": "master",
"created_at": "2019-11-16T08:08:03Z",
"updated_at": "2019-11-16T08:12:33Z"
},
"sender": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
}
}

View File

@@ -0,0 +1,139 @@
{
"action": "synchronized",
"number": 2,
"pull_request": {
"id": 1349,
"number": 2,
"user": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"title": "Test",
"body": "",
"labels": [],
"milestone": null,
"assignee": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"state": "open",
"comments": 3,
"head_branch": "c",
"head_repo": {
"id": 23925,
"owner": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"name": "test",
"full_name": "kostekIV/test",
"description": "",
"private": false,
"fork": false,
"parent": null,
"empty": false,
"mirror": false,
"size": 49152,
"html_url": "https://try.gogs.io/kostekIV/test",
"ssh_url": "git@try.gogs.io:kostekIV/test.git",
"clone_url": "https://try.gogs.io/kostekIV/test.git",
"website": "",
"stars_count": 1,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 2,
"default_branch": "master",
"created_at": "2019-11-16T08:08:03Z",
"updated_at": "2019-11-17T23:18:17Z"
},
"base_branch": "master",
"base_repo": {
"id": 23925,
"owner": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"name": "test",
"full_name": "kostekIV/test",
"description": "",
"private": false,
"fork": false,
"parent": null,
"empty": false,
"mirror": false,
"size": 49152,
"html_url": "https://try.gogs.io/kostekIV/test",
"ssh_url": "git@try.gogs.io:kostekIV/test.git",
"clone_url": "https://try.gogs.io/kostekIV/test.git",
"website": "",
"stars_count": 1,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 2,
"default_branch": "master",
"created_at": "2019-11-16T08:08:03Z",
"updated_at": "2019-11-17T23:18:17Z"
},
"html_url": "https://try.gogs.io/kostekIV/test/pulls/2",
"mergeable": false,
"merged": false,
"merged_at": null,
"merge_commit_sha": null,
"merged_by": null
},
"repository": {
"id": 23925,
"owner": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
},
"name": "test",
"full_name": "kostekIV/test",
"description": "",
"private": false,
"fork": false,
"parent": null,
"empty": false,
"mirror": false,
"size": 49152,
"html_url": "https://try.gogs.io/kostekIV/test",
"ssh_url": "git@try.gogs.io:kostekIV/test.git",
"clone_url": "https://try.gogs.io/kostekIV/test.git",
"website": "",
"stars_count": 1,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 2,
"default_branch": "master",
"created_at": "2019-11-16T08:08:03Z",
"updated_at": "2019-11-17T23:18:17Z"
},
"sender": {
"id": 43132,
"username": "kostekIV",
"login": "kostekIV",
"full_name": "",
"email": "koscis.j@gmail.com",
"avatar_url": "https://secure.gravatar.com/avatar/91fe35565bf6198f03688b89fdb0a19a?d=identicon"
}
}

View File

@@ -0,0 +1,68 @@
{
"secret": "",
"ref": "refs/heads/master",
"before": "479e6b772b7fba19412457483f50b201286d0103",
"after": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"compare_url": "http://localhost:3000/john/try-git/compare/479e6b772b7fba19412457483f50b201286d0103...d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"commits": [
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
}
],
"repository": {
"id": 1,
"owner": {
"id": 1,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/ab4e102452ed53394cba1eb306de04c4",
"username": "john"
},
"name": "try-git",
"full_name": "john/try-git",
"description": "",
"private": false,
"fork": false,
"html_url": "http://localhost:3000/john/try-git",
"ssh_url": "john@localhost:john/try-git.git",
"clone_url": "http://localhost:3000/john/try-git.git",
"website": "",
"stars_count": 0,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 0,
"default_branch": "master",
"created_at": "2017-01-27T17:21:00-05:00",
"updated_at": "2017-01-27T17:22:47-05:00"
},
"pusher": {
"id": 1,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/ab4e102452ed53394cba1eb306de04c4",
"username": "john"
},
"sender": {
"id": 1,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/ab4e102452ed53394cba1eb306de04c4",
"username": "john"
}
}

View File

@@ -0,0 +1,532 @@
{
"secret": "",
"ref": "refs/heads/master",
"before": "479e6b772b7fba19412457483f50b201286d0103",
"after": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"compare_url": "http://localhost:3000/john/try-git/compare/479e6b772b7fba19412457483f50b201286d0103...d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"commits": [
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
}
],
"repository": {
"id": 1,
"owner": {
"id": 1,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/ab4e102452ed53394cba1eb306de04c4",
"username": "john"
},
"name": "try-git",
"full_name": "john/try-git",
"description": "",
"private": false,
"fork": false,
"html_url": "http://localhost:3000/john/try-git",
"ssh_url": "john@localhost:john/try-git.git",
"clone_url": "http://localhost:3000/john/try-git.git",
"website": "",
"stars_count": 0,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 0,
"default_branch": "master",
"created_at": "2017-01-27T17:21:00-05:00",
"updated_at": "2017-01-27T17:22:47-05:00"
},
"pusher": {
"id": 1,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/ab4e102452ed53394cba1eb306de04c4",
"username": "john"
},
"sender": {
"id": 1,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/ab4e102452ed53394cba1eb306de04c4",
"username": "john"
}
}

View File

@@ -0,0 +1,84 @@
{
"secret": "",
"ref": "refs/heads/master",
"before": "479e6b772b7fba19412457483f50b201286d0103",
"after": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"compare_url": "http://localhost:3000/john/try-git/compare/479e6b772b7fba19412457483f50b201286d0103...d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"commits": [
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
},
{
"id": "d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"message": "Webhook Test\n",
"url": "http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794",
"author": {
"name": "Benjamin",
"email": "ben@example.com",
"username": ""
},
"committer": {
"name": "John Doe",
"email": "john@example.com",
"username": ""
},
"timestamp": "2017-01-28T08:54:49-05:00"
}
],
"repository": {
"id": 1,
"owner": {
"id": 1,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/ab4e102452ed53394cba1eb306de04c4",
"username": "john"
},
"name": "try-git",
"full_name": "john/try-git",
"description": "",
"private": false,
"fork": false,
"html_url": "http://localhost:3000/john/try-git",
"ssh_url": "john@localhost:john/try-git.git",
"clone_url": "http://localhost:3000/john/try-git.git",
"website": "",
"stars_count": 0,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 0,
"default_branch": "master",
"created_at": "2017-01-27T17:21:00-05:00",
"updated_at": "2017-01-27T17:22:47-05:00"
},
"pusher": {
"id": 1,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/ab4e102452ed53394cba1eb306de04c4",
"username": "john"
},
"sender": {
"id": 1,
"login": "john",
"full_name": "",
"email": "john@example.com",
"avatar_url": "https://secure.gravatar.com/avatar/ab4e102452ed53394cba1eb306de04c4",
"username": "john"
}
}

View File

@@ -0,0 +1,60 @@
{
"action": "published",
"release": {
"id": 620,
"tag_name": "v1.4",
"target_commitish": "master",
"name": "Title",
"body": "Content",
"draft": false,
"prerelease": false,
"author": {
"id": 54021,
"username": "cestrell",
"login": "cestrell",
"full_name": "",
"email": "cestrell@umich.edu",
"avatar_url": "https://secure.gravatar.com/avatar/9d38a3e0dfca4e5784288da94c98ff34?d=identicon"
},
"created_at": "2020-05-11T04:47:11Z"
},
"repository": {
"id": 26908,
"owner": {
"id": 54021,
"username": "cestrell",
"login": "cestrell",
"full_name": "",
"email": "cestrell@umich.edu",
"avatar_url": "https://secure.gravatar.com/avatar/9d38a3e0dfca4e5784288da94c98ff34?d=identicon"
},
"name": "zulip_test",
"full_name": "cestrell/zulip_test",
"description": "",
"private": false,
"fork": false,
"parent": null,
"empty": false,
"mirror": false,
"size": 16384,
"html_url": "https://try.gogs.io/cestrell/zulip_test",
"ssh_url": "git@try.gogs.io:cestrell/zulip_test.git",
"clone_url": "https://try.gogs.io/cestrell/zulip_test.git",
"website": "",
"stars_count": 0,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 0,
"default_branch": "master",
"created_at": "2020-04-25T16:02:30Z",
"updated_at": "2020-04-25T16:15:49Z"
},
"sender": {
"id": 54021,
"username": "cestrell",
"login": "cestrell",
"full_name": "",
"email": "cestrell@umich.edu",
"avatar_url": "https://secure.gravatar.com/avatar/9d38a3e0dfca4e5784288da94c98ff34?d=identicon"
}
}

View File

@@ -0,0 +1,175 @@
from unittest.mock import MagicMock, patch
from zerver.lib.test_classes import WebhookTestCase
from zerver.lib.webhooks.git import COMMITS_LIMIT
class GogsHookTests(WebhookTestCase):
def test_push(self) -> None:
expected_topic_name = "try-git / master"
expected_message = """john [pushed](http://localhost:3000/john/try-git/compare/479e6b772b7fba19412457483f50b201286d0103...d8fce16c72a2ff56a5afc8a08645a6ce45491794) 1 commit to branch master. Commits by John (1).
* Webhook Test ([d8fce16c72a](http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794))"""
self.check_webhook("push", expected_topic_name, expected_message)
def test_push_multiple_committers(self) -> None:
commit_info = "* Webhook Test ([d8fce16c72a](http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794))\n"
expected_topic_name = "try-git / master"
expected_message = f"""john [pushed](http://localhost:3000/john/try-git/compare/479e6b772b7fba19412457483f50b201286d0103...d8fce16c72a2ff56a5afc8a08645a6ce45491794) 2 commits to branch master. Commits by Benjamin (1) and John (1).\n\n{commit_info}* Webhook Test ([d8fce16c72a](http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794))"""
self.check_webhook(
"push__commits_multiple_committers", expected_topic_name, expected_message
)
def test_push_multiple_committers_filtered_by_branches(self) -> None:
self.url = self.build_webhook_url(branches="master,development")
commit_info = "* Webhook Test ([d8fce16c72a](http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794))\n"
expected_topic_name = "try-git / master"
expected_message = f"""john [pushed](http://localhost:3000/john/try-git/compare/479e6b772b7fba19412457483f50b201286d0103...d8fce16c72a2ff56a5afc8a08645a6ce45491794) 2 commits to branch master. Commits by Benjamin (1) and John (1).\n\n{commit_info}* Webhook Test ([d8fce16c72a](http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794))"""
self.check_webhook(
"push__commits_multiple_committers", expected_topic_name, expected_message
)
def test_push_filtered_by_branches(self) -> None:
self.url = self.build_webhook_url(branches="master,development")
expected_topic_name = "try-git / master"
expected_message = """john [pushed](http://localhost:3000/john/try-git/compare/479e6b772b7fba19412457483f50b201286d0103...d8fce16c72a2ff56a5afc8a08645a6ce45491794) 1 commit to branch master. Commits by John (1).
* Webhook Test ([d8fce16c72a](http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794))"""
self.check_webhook("push", expected_topic_name, expected_message)
def test_push_commits_more_than_limits(self) -> None:
expected_topic_name = "try-git / master"
commits_info = "* Webhook Test ([d8fce16c72a](http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794))\n"
expected_message = f"john [pushed](http://localhost:3000/john/try-git/compare/479e6b772b7fba19412457483f50b201286d0103...d8fce16c72a2ff56a5afc8a08645a6ce45491794) 30 commits to branch master. Commits by John (30).\n\n{commits_info * COMMITS_LIMIT}[and {30 - COMMITS_LIMIT} more commit(s)]"
self.check_webhook("push__commits_more_than_limits", expected_topic_name, expected_message)
def test_push_commits_more_than_limits_filtered_by_branches(self) -> None:
self.url = self.build_webhook_url(branches="master,development")
expected_topic_name = "try-git / master"
commits_info = "* Webhook Test ([d8fce16c72a](http://localhost:3000/john/try-git/commit/d8fce16c72a2ff56a5afc8a08645a6ce45491794))\n"
expected_message = f"john [pushed](http://localhost:3000/john/try-git/compare/479e6b772b7fba19412457483f50b201286d0103...d8fce16c72a2ff56a5afc8a08645a6ce45491794) 30 commits to branch master. Commits by John (30).\n\n{commits_info * COMMITS_LIMIT}[and {30 - COMMITS_LIMIT} more commit(s)]"
self.check_webhook("push__commits_more_than_limits", expected_topic_name, expected_message)
def test_new_branch(self) -> None:
expected_topic_name = "try-git / my_feature"
expected_message = (
"john created [my_feature](http://localhost:3000/john/try-git/src/my_feature) branch."
)
self.check_webhook("create__branch", expected_topic_name, expected_message)
def test_pull_request_opened(self) -> None:
expected_topic_name = "try-git / PR #1 Title Text for Pull Request"
expected_message = """john opened [PR #1](http://localhost:3000/john/try-git/pulls/1) from `feature` to `master`."""
self.check_webhook("pull_request__opened", expected_topic_name, expected_message)
def test_pull_request_opened_with_custom_topic_in_url(self) -> None:
self.url = self.build_webhook_url(topic="notifications")
expected_topic_name = "notifications"
expected_message = """john opened [PR #1 Title Text for Pull Request](http://localhost:3000/john/try-git/pulls/1) from `feature` to `master`."""
self.check_webhook("pull_request__opened", expected_topic_name, expected_message)
def test_pull_request_closed(self) -> None:
expected_topic_name = "try-git / PR #1 Title Text for Pull Request"
expected_message = """john closed [PR #1](http://localhost:3000/john/try-git/pulls/1) from `feature` to `master`."""
self.check_webhook("pull_request__closed", expected_topic_name, expected_message)
def test_pull_request_merged(self) -> None:
expected_topic_name = "try-git / PR #2 Title Text for Pull Request"
expected_message = """john merged [PR #2](http://localhost:3000/john/try-git/pulls/2) from `feature` to `master`."""
self.check_webhook("pull_request__merged", expected_topic_name, expected_message)
def test_pull_request_reopened(self) -> None:
expected_topic_name = "test / PR #1349 reopened"
expected_message = """kostekIV reopened [PR #2](https://try.gogs.io/kostekIV/test/pulls/2) from `c` to `master`."""
self.check_webhook("pull_request__reopened", expected_topic_name, expected_message)
def test_pull_request_edited(self) -> None:
expected_topic_name = "test / PR #1349 Test"
expected_message = """kostekIV edited [PR #2](https://try.gogs.io/kostekIV/test/pulls/2)."""
self.check_webhook("pull_request__edited", expected_topic_name, expected_message)
def test_pull_request_assigned(self) -> None:
expected_topic_name = "test / PR #1349 Test"
expected_message = """kostekIV assigned kostekIV to [PR #2](https://try.gogs.io/kostekIV/test/pulls/2) from `c` to `master`."""
self.check_webhook("pull_request__assigned", expected_topic_name, expected_message)
def test_pull_request_synchronized(self) -> None:
expected_topic_name = "test / PR #1349 Test"
expected_message = """kostekIV synchronized [PR #2](https://try.gogs.io/kostekIV/test/pulls/2) from `c` to `master`."""
self.check_webhook("pull_request__synchronized", expected_topic_name, expected_message)
def test_issues_opened(self) -> None:
expected_topic_name = "test / issue #3 New test issue"
expected_message = """kostekIV opened [issue #3](https://try.gogs.io/kostekIV/test/issues/3):\n\n``` quote\nTest\n```"""
self.check_webhook("issues__opened", expected_topic_name, expected_message)
def test_issues_reopened(self) -> None:
expected_topic_name = "test / issue #3 New test issue"
expected_message = """kostekIV reopened [issue #3](https://try.gogs.io/kostekIV/test/issues/3):\n\n``` quote\nTest\n```"""
self.check_webhook("issues__reopened", expected_topic_name, expected_message)
def test_issues_edited(self) -> None:
expected_topic_name = "test / issue #3 New test issue"
expected_message = """kostekIV edited [issue #3](https://try.gogs.io/kostekIV/test/issues/3):\n\n``` quote\nTest edit\n```"""
self.check_webhook("issues__edited", expected_topic_name, expected_message)
def test_issues_assignee(self) -> None:
expected_topic_name = "test / issue #3 New test issue"
expected_message = """kostekIV assigned kostekIV to [issue #3](https://try.gogs.io/kostekIV/test/issues/3) (assigned to kostekIV):\n\n``` quote\nTest\n```"""
self.check_webhook("issues__assigned", expected_topic_name, expected_message)
def test_issues_closed(self) -> None:
expected_topic_name = "test / issue #3 New test issue"
expected_message = """kostekIV closed [issue #3](https://try.gogs.io/kostekIV/test/issues/3):\n\n``` quote\nClosed #3\n```"""
self.check_webhook("issues__closed", expected_topic_name, expected_message)
def test_issue_comment_new(self) -> None:
expected_topic_name = "test / issue #3 New test issue"
expected_message = """kostekIV [commented](https://try.gogs.io/kostekIV/test/issues/3#issuecomment-3635) on [issue #3](https://try.gogs.io/kostekIV/test/issues/3):\n\n``` quote\nTest comment\n```"""
self.check_webhook("issue_comment__new", expected_topic_name, expected_message)
def test_issue_comment_edited(self) -> None:
expected_topic_name = "test / issue #3 New test issue"
expected_message = """kostekIV edited a [comment](https://try.gogs.io/kostekIV/test/issues/3#issuecomment-3634) on [issue #3](https://try.gogs.io/kostekIV/test/issues/3):\n\n``` quote\nedit comment\n```"""
self.check_webhook("issue_comment__edited", expected_topic_name, expected_message)
def test_release_published(self) -> None:
expected_topic_name = "zulip_test / v1.4 Title"
expected_message = """cestrell published release [Title](https://try.gogs.io/cestrell/zulip_test) for tag v1.4."""
self.check_webhook("release__published", expected_topic_name, expected_message)
@patch("zerver.webhooks.gogs.view.check_send_webhook_message")
def test_push_filtered_by_branches_ignore(
self, check_send_webhook_message_mock: MagicMock
) -> None:
self.url = self.build_webhook_url(branches="changes,development")
payload = self.get_body("push")
result = self.client_post(
self.url, payload, HTTP_X_GOGS_EVENT="push", content_type="application/json"
)
self.assertFalse(check_send_webhook_message_mock.called)
self.assert_json_success(result)
@patch("zerver.webhooks.gogs.view.check_send_webhook_message")
def test_push_commits_more_than_limits_filtered_by_branches_ignore(
self, check_send_webhook_message_mock: MagicMock
) -> None:
self.url = self.build_webhook_url(branches="changes,development")
payload = self.get_body("push__commits_more_than_limits")
result = self.client_post(
self.url, payload, HTTP_X_GOGS_EVENT="push", content_type="application/json"
)
self.assertFalse(check_send_webhook_message_mock.called)
self.assert_json_success(result)
@patch("zerver.webhooks.gogs.view.check_send_webhook_message")
def test_push_multiple_committers_filtered_by_branches_ignore(
self, check_send_webhook_message_mock: MagicMock
) -> None:
self.url = self.build_webhook_url(branches="changes,development")
payload = self.get_body("push__commits_multiple_committers")
result = self.client_post(
self.url, payload, HTTP_X_GOGS_EVENT="push", content_type="application/json"
)
self.assertFalse(check_send_webhook_message_mock.called)
self.assert_json_success(result)

View File

@@ -0,0 +1,264 @@
# vim:fenc=utf-8
from typing import Protocol
from django.http import HttpRequest, HttpResponse
from zerver.decorator import webhook_view
from zerver.lib.exceptions import UnsupportedWebhookEventTypeError
from zerver.lib.response import json_success
from zerver.lib.typed_endpoint import JsonBodyPayload, typed_endpoint
from zerver.lib.validator import WildValue, check_bool, check_int, check_string
from zerver.lib.webhooks.common import (
OptionalUserSpecifiedTopicStr,
check_send_webhook_message,
default_fixture_to_headers,
get_event_header,
)
from zerver.lib.webhooks.git import (
TOPIC_WITH_BRANCH_TEMPLATE,
TOPIC_WITH_PR_OR_ISSUE_INFO_TEMPLATE,
TOPIC_WITH_RELEASE_TEMPLATE,
get_create_branch_event_message,
get_issue_event_message,
get_pull_request_event_message,
get_push_commits_event_message,
get_release_event_message,
is_branch_name_notifiable,
)
from zerver.models import UserProfile
fixture_to_headers = default_fixture_to_headers("HTTP_X_GOGS_EVENT")
def get_issue_url(repo_url: str, issue_nr: int) -> str:
return f"{repo_url}/issues/{issue_nr}"
def format_push_event(payload: WildValue) -> str:
user_name = payload["sender"]["username"].tame(check_string)
compare_url = payload["compare_url"].tame(check_string)
branch_name = payload["ref"].tame(check_string).replace("refs/heads/", "")
commits_data = _transform_commits_list_to_common_format(payload["commits"])
return get_push_commits_event_message(
user_name=user_name,
compare_url=compare_url,
branch_name=branch_name,
commits_data=commits_data,
)
def _transform_commits_list_to_common_format(commits: WildValue) -> list[dict[str, str]]:
return [
{
"name": commit["author"]["username"].tame(check_string)
or commit["author"]["name"].tame(check_string).split()[0],
"sha": commit["id"].tame(check_string),
"url": commit["url"].tame(check_string),
"message": commit["message"].tame(check_string),
}
for commit in commits
]
def format_new_branch_event(payload: WildValue) -> str:
branch_name = payload["ref"].tame(check_string)
url = "{}/src/{}".format(payload["repository"]["html_url"].tame(check_string), branch_name)
data = {
"user_name": payload["sender"]["username"].tame(check_string),
"url": url,
"branch_name": branch_name,
}
return get_create_branch_event_message(**data)
def format_pull_request_event(payload: WildValue, include_title: bool = False) -> str:
if payload["pull_request"]["merged"].tame(check_bool):
user_name = payload["pull_request"]["merged_by"]["username"].tame(check_string)
action = "merged"
else:
user_name = payload["pull_request"]["user"]["username"].tame(check_string)
action = payload["action"].tame(check_string)
url = payload["pull_request"]["html_url"].tame(check_string)
number = payload["pull_request"]["number"].tame(check_int)
target_branch = None
base_branch = None
if action != "edited":
target_branch = payload["pull_request"]["head_branch"].tame(check_string)
base_branch = payload["pull_request"]["base_branch"].tame(check_string)
title = payload["pull_request"]["title"].tame(check_string) if include_title else None
stringified_assignee = (
payload["pull_request"]["assignee"]["login"].tame(check_string)
if payload["action"] and payload["pull_request"]["assignee"]
else None
)
return get_pull_request_event_message(
user_name=user_name,
action=action,
url=url,
number=number,
target_branch=target_branch,
base_branch=base_branch,
title=title,
assignee_updated=stringified_assignee,
)
def format_issues_event(payload: WildValue, include_title: bool = False) -> str:
issue_nr = payload["issue"]["number"].tame(check_int)
assignee = payload["issue"]["assignee"]
stringified_assignee = assignee["login"].tame(check_string) if assignee else None
action = payload["action"].tame(check_string)
return get_issue_event_message(
user_name=payload["sender"]["login"].tame(check_string),
action=payload["action"].tame(check_string),
url=get_issue_url(payload["repository"]["html_url"].tame(check_string), issue_nr),
number=issue_nr,
message=payload["issue"]["body"].tame(check_string),
assignee=stringified_assignee,
title=payload["issue"]["title"].tame(check_string) if include_title else None,
assignee_updated=stringified_assignee if action == "assigned" else None,
)
def format_issue_comment_event(payload: WildValue, include_title: bool = False) -> str:
action = payload["action"].tame(check_string)
comment = payload["comment"]
issue = payload["issue"]
if action == "created":
action = "[commented]"
else:
action = f"{action} a [comment]"
action += "({}) on".format(comment["html_url"].tame(check_string))
return get_issue_event_message(
user_name=payload["sender"]["login"].tame(check_string),
action=action,
url=get_issue_url(
payload["repository"]["html_url"].tame(check_string), issue["number"].tame(check_int)
),
number=issue["number"].tame(check_int),
message=comment["body"].tame(check_string),
title=issue["title"].tame(check_string) if include_title else None,
)
def format_release_event(payload: WildValue, include_title: bool = False) -> str:
data = {
"user_name": payload["release"]["author"]["username"].tame(check_string),
"action": payload["action"].tame(check_string),
"tagname": payload["release"]["tag_name"].tame(check_string),
"release_name": payload["release"]["name"].tame(check_string),
"url": payload["repository"]["html_url"].tame(check_string),
}
return get_release_event_message(**data)
ALL_EVENT_TYPES = ["issue_comment", "issues", "create", "pull_request", "push", "release"]
@webhook_view("Gogs", all_event_types=ALL_EVENT_TYPES)
@typed_endpoint
def api_gogs_webhook(
request: HttpRequest,
user_profile: UserProfile,
*,
payload: JsonBodyPayload[WildValue],
branches: str | None = None,
user_specified_topic: OptionalUserSpecifiedTopicStr = None,
) -> HttpResponse:
return gogs_webhook_main(
"Gogs",
"X-Gogs-Event",
format_pull_request_event,
request,
user_profile,
payload,
branches,
user_specified_topic,
)
class FormatPullRequestEvent(Protocol):
def __call__(self, payload: WildValue, include_title: bool) -> str: ...
def gogs_webhook_main(
integration_name: str,
http_header_name: str,
format_pull_request_event: FormatPullRequestEvent,
request: HttpRequest,
user_profile: UserProfile,
payload: WildValue,
branches: str | None,
user_specified_topic: str | None,
) -> HttpResponse:
repo = payload["repository"]["name"].tame(check_string)
event = get_event_header(request, http_header_name, integration_name)
if event == "push":
branch = payload["ref"].tame(check_string).replace("refs/heads/", "")
if not is_branch_name_notifiable(branch, branches):
return json_success(request)
body = format_push_event(payload)
topic_name = TOPIC_WITH_BRANCH_TEMPLATE.format(
repo=repo,
branch=branch,
)
elif event == "create":
body = format_new_branch_event(payload)
topic_name = TOPIC_WITH_BRANCH_TEMPLATE.format(
repo=repo,
branch=payload["ref"].tame(check_string),
)
elif event == "pull_request":
body = format_pull_request_event(
payload,
include_title=user_specified_topic is not None,
)
topic_name = TOPIC_WITH_PR_OR_ISSUE_INFO_TEMPLATE.format(
repo=repo,
type="PR",
id=payload["pull_request"]["id"].tame(check_int),
title=payload["pull_request"]["title"].tame(check_string),
)
elif event == "issues":
body = format_issues_event(
payload,
include_title=user_specified_topic is not None,
)
topic_name = TOPIC_WITH_PR_OR_ISSUE_INFO_TEMPLATE.format(
repo=repo,
type="issue",
id=payload["issue"]["number"].tame(check_int),
title=payload["issue"]["title"].tame(check_string),
)
elif event == "issue_comment":
body = format_issue_comment_event(
payload,
include_title=user_specified_topic is not None,
)
topic_name = TOPIC_WITH_PR_OR_ISSUE_INFO_TEMPLATE.format(
repo=repo,
type="issue",
id=payload["issue"]["number"].tame(check_int),
title=payload["issue"]["title"].tame(check_string),
)
elif event == "release":
body = format_release_event(
payload,
include_title=user_specified_topic is not None,
)
topic_name = TOPIC_WITH_RELEASE_TEMPLATE.format(
repo=repo,
tag=payload["release"]["tag_name"].tame(check_string),
title=payload["release"]["name"].tame(check_string),
)
else:
raise UnsupportedWebhookEventTypeError(event)
check_send_webhook_message(request, user_profile, topic_name, body, event)
return json_success(request)