From a02de81c8ee997fc0aff3c6ebe18841903a75fd6 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Wed, 28 May 2025 08:23:30 +0100 Subject: [PATCH] Move gitea fixtures into own files (#5208) --- .../forge/gitea/fixtures/HookPullRequest.json | 58 + .../gitea/fixtures/HookPullRequestClosed.json | 356 ++++ .../gitea/fixtures/HookPullRequestMerged.json | 378 +++++ .../fixtures/HookPullRequestUpdated.json | 137 ++ server/forge/gitea/fixtures/HookPush.json | 57 + .../forge/gitea/fixtures/HookPushBranch.json | 148 ++ .../forge/gitea/fixtures/HookPushMulti.json | 184 ++ server/forge/gitea/fixtures/HookRelease.json | 136 ++ server/forge/gitea/fixtures/HookTag.json | 41 + server/forge/gitea/fixtures/hooks.go | 1479 +---------------- 10 files changed, 1520 insertions(+), 1454 deletions(-) create mode 100644 server/forge/gitea/fixtures/HookPullRequest.json create mode 100644 server/forge/gitea/fixtures/HookPullRequestClosed.json create mode 100644 server/forge/gitea/fixtures/HookPullRequestMerged.json create mode 100644 server/forge/gitea/fixtures/HookPullRequestUpdated.json create mode 100644 server/forge/gitea/fixtures/HookPush.json create mode 100644 server/forge/gitea/fixtures/HookPushBranch.json create mode 100644 server/forge/gitea/fixtures/HookPushMulti.json create mode 100644 server/forge/gitea/fixtures/HookRelease.json create mode 100644 server/forge/gitea/fixtures/HookTag.json diff --git a/server/forge/gitea/fixtures/HookPullRequest.json b/server/forge/gitea/fixtures/HookPullRequest.json new file mode 100644 index 000000000..2d7f54053 --- /dev/null +++ b/server/forge/gitea/fixtures/HookPullRequest.json @@ -0,0 +1,58 @@ +{ + "action": "opened", + "number": 1, + "pull_request": { + "html_url": "http://gitea.golang.org/gordon/hello-world/pull/1", + "state": "open", + "title": "Update the README with new information", + "body": "please merge", + "user": { + "id": 1, + "username": "gordon", + "login": "gordon", + "full_name": "Gordon the Gopher", + "email": "gordon@golang.org", + "avatar_url": "http://gitea.golang.org///1.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" + }, + "base": { + "label": "main", + "ref": "main", + "sha": "9353195a19e45482665306e466c832c46560532d" + }, + "head": { + "label": "feature/changes", + "ref": "feature/changes", + "sha": "0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c" + } + }, + "repository": { + "id": 35129377, + "name": "hello-world", + "full_name": "gordon/hello-world", + "owner": { + "id": 1, + "username": "gordon", + "login": "gordon", + "full_name": "Gordon the Gopher", + "email": "gordon@golang.org", + "avatar_url": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" + }, + "private": true, + "html_url": "http://gitea.golang.org/gordon/hello-world", + "clone_url": "https://gitea.golang.org/gordon/hello-world.git", + "default_branch": "main", + "permissions": { + "admin": true, + "push": true, + "pull": true + } + }, + "sender": { + "id": 1, + "login": "gordon", + "username": "gordon", + "full_name": "Gordon the Gopher", + "email": "gordon@golang.org", + "avatar_url": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" + } +} diff --git a/server/forge/gitea/fixtures/HookPullRequestClosed.json b/server/forge/gitea/fixtures/HookPullRequestClosed.json new file mode 100644 index 000000000..5402b22d3 --- /dev/null +++ b/server/forge/gitea/fixtures/HookPullRequestClosed.json @@ -0,0 +1,356 @@ +{ + "action": "closed", + "number": 1, + "pull_request": { + "id": 62112, + "url": "https://gitea.com/anbraten/test-repo/pulls/1", + "number": 1, + "user": { + "id": 26907, + "login": "anbraten", + "login_name": "", + "full_name": "", + "email": "anbraten@gitea.com", + "avatar_url": "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", + "language": "", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2021-07-19T23:21:52Z", + "restricted": false, + "active": false, + "prohibit_login": false, + "location": "", + "website": "", + "description": "", + "visibility": "public", + "followers_count": 0, + "following_count": 0, + "starred_repos_count": 1, + "username": "anbraten" + }, + "title": "Adjust file", + "body": "", + "labels": [], + "milestone": null, + "assignee": null, + "assignees": null, + "requested_reviewers": null, + "state": "closed", + "is_locked": false, + "comments": 0, + "html_url": "https://gitea.com/anbraten/test-repo/pulls/1", + "diff_url": "https://gitea.com/anbraten/test-repo/pulls/1.diff", + "patch_url": "https://gitea.com/anbraten/test-repo/pulls/1.patch", + "mergeable": true, + "merged": false, + "merged_at": null, + "merge_commit_sha": null, + "merged_by": null, + "allow_maintainer_edit": false, + "base": { + "label": "main", + "ref": "main", + "sha": "068aee163ffd44eef28a7f9ebd43e2c01774f0fa", + "repo_id": 46534, + "repo": { + "id": 46534, + "owner": { + "id": 26907, + "login": "anbraten", + "login_name": "", + "full_name": "", + "email": "anbraten@noreply.gitea.com", + "avatar_url": "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", + "language": "", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2021-07-19T23:21:52Z", + "restricted": false, + "active": false, + "prohibit_login": false, + "location": "", + "website": "", + "description": "", + "visibility": "public", + "followers_count": 0, + "following_count": 0, + "starred_repos_count": 1, + "username": "anbraten" + }, + "name": "test-repo", + "full_name": "anbraten/test-repo", + "description": "", + "empty": false, + "private": false, + "fork": false, + "template": false, + "parent": null, + "mirror": false, + "size": 26, + "language": "", + "languages_url": "https://gitea.com/api/v1/repos/anbraten/test-repo/languages", + "html_url": "https://gitea.com/anbraten/test-repo", + "url": "https://gitea.com/api/v1/repos/anbraten/test-repo", + "link": "", + "ssh_url": "git@gitea.com:anbraten/test-repo.git", + "clone_url": "https://gitea.com/anbraten/test-repo.git", + "original_url": "", + "website": "", + "stars_count": 0, + "forks_count": 0, + "watchers_count": 1, + "open_issues_count": 0, + "open_pr_counter": 1, + "release_counter": 0, + "default_branch": "main", + "archived": false, + "created_at": "2023-12-05T18:03:55Z", + "updated_at": "2023-12-05T18:06:29Z", + "archived_at": "1970-01-01T00:00:00Z", + "permissions": { + "admin": false, + "push": false, + "pull": true + }, + "has_issues": true, + "internal_tracker": { + "enable_time_tracker": true, + "allow_only_contributors_to_track_time": true, + "enable_issue_dependencies": true + }, + "has_wiki": true, + "has_pull_requests": true, + "has_projects": true, + "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_rebase_update": true, + "default_delete_branch_after_merge": false, + "default_merge_style": "merge", + "default_allow_maintainer_edit": false, + "avatar_url": "", + "internal": false, + "mirror_interval": "", + "mirror_updated": "0001-01-01T00:00:00Z", + "repo_transfer": null + } + }, + "head": { + "label": "anbraten-patch-1", + "ref": "anbraten-patch-1", + "sha": "d555a5dd07f4d0148a58d4686ec381502ae6a2d4", + "repo_id": 46534, + "repo": { + "id": 46534, + "owner": { + "id": 26907, + "login": "anbraten", + "login_name": "", + "full_name": "", + "email": "anbraten@noreply.gitea.com", + "avatar_url": "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", + "language": "", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2021-07-19T23:21:52Z", + "restricted": false, + "active": false, + "prohibit_login": false, + "location": "", + "website": "", + "description": "", + "visibility": "public", + "followers_count": 0, + "following_count": 0, + "starred_repos_count": 1, + "username": "anbraten" + }, + "name": "test-repo", + "full_name": "anbraten/test-repo", + "description": "", + "empty": false, + "private": false, + "fork": false, + "template": false, + "parent": null, + "mirror": false, + "size": 26, + "language": "", + "languages_url": "https://gitea.com/api/v1/repos/anbraten/test-repo/languages", + "html_url": "https://gitea.com/anbraten/test-repo", + "url": "https://gitea.com/api/v1/repos/anbraten/test-repo", + "link": "", + "ssh_url": "git@gitea.com:anbraten/test-repo.git", + "clone_url": "https://gitea.com/anbraten/test-repo.git", + "original_url": "", + "website": "", + "stars_count": 0, + "forks_count": 0, + "watchers_count": 1, + "open_issues_count": 0, + "open_pr_counter": 1, + "release_counter": 0, + "default_branch": "main", + "archived": false, + "created_at": "2023-12-05T18:03:55Z", + "updated_at": "2023-12-05T18:06:29Z", + "archived_at": "1970-01-01T00:00:00Z", + "permissions": { + "admin": false, + "push": false, + "pull": true + }, + "has_issues": true, + "internal_tracker": { + "enable_time_tracker": true, + "allow_only_contributors_to_track_time": true, + "enable_issue_dependencies": true + }, + "has_wiki": true, + "has_pull_requests": true, + "has_projects": true, + "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_rebase_update": true, + "default_delete_branch_after_merge": false, + "default_merge_style": "merge", + "default_allow_maintainer_edit": false, + "avatar_url": "", + "internal": false, + "mirror_interval": "", + "mirror_updated": "0001-01-01T00:00:00Z", + "repo_transfer": null + } + }, + "merge_base": "068aee163ffd44eef28a7f9ebd43e2c01774f0fa", + "due_date": null, + "created_at": "2023-12-05T18:06:38Z", + "updated_at": "2023-12-05T18:06:43Z", + "closed_at": "2023-12-05T18:06:43Z", + "pin_order": 0 + }, + "requested_reviewer": null, + "repository": { + "id": 46534, + "owner": { + "id": 26907, + "login": "anbraten", + "login_name": "", + "full_name": "", + "email": "anbraten@repo.gitea.com", + "avatar_url": "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", + "language": "", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2021-07-19T23:21:52Z", + "restricted": false, + "active": false, + "prohibit_login": false, + "location": "", + "website": "", + "description": "", + "visibility": "public", + "followers_count": 0, + "following_count": 0, + "starred_repos_count": 1, + "username": "anbraten" + }, + "name": "test-repo", + "full_name": "anbraten/test-repo", + "description": "", + "empty": false, + "private": false, + "fork": false, + "template": false, + "parent": null, + "mirror": false, + "size": 26, + "language": "", + "languages_url": "https://gitea.com/api/v1/repos/anbraten/test-repo/languages", + "html_url": "https://gitea.com/anbraten/test-repo", + "url": "https://gitea.com/api/v1/repos/anbraten/test-repo", + "link": "", + "ssh_url": "git@gitea.com:anbraten/test-repo.git", + "clone_url": "https://gitea.com/anbraten/test-repo.git", + "original_url": "", + "website": "", + "stars_count": 0, + "forks_count": 0, + "watchers_count": 1, + "open_issues_count": 0, + "open_pr_counter": 1, + "release_counter": 0, + "default_branch": "main", + "archived": false, + "created_at": "2023-12-05T18:03:55Z", + "updated_at": "2023-12-05T18:06:29Z", + "archived_at": "1970-01-01T00:00:00Z", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "has_issues": true, + "internal_tracker": { + "enable_time_tracker": true, + "allow_only_contributors_to_track_time": true, + "enable_issue_dependencies": true + }, + "has_wiki": true, + "has_pull_requests": true, + "has_projects": true, + "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_rebase_update": true, + "default_delete_branch_after_merge": false, + "default_merge_style": "merge", + "default_allow_maintainer_edit": false, + "avatar_url": "", + "internal": false, + "mirror_interval": "", + "mirror_updated": "0001-01-01T00:00:00Z", + "repo_transfer": null + }, + "sender": { + "id": 26907, + "login": "anbraten", + "login_name": "", + "full_name": "", + "email": "anbraten@sender.gitea.com", + "avatar_url": "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", + "language": "", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2021-07-19T23:21:52Z", + "restricted": false, + "active": false, + "prohibit_login": false, + "location": "", + "website": "", + "description": "", + "visibility": "public", + "followers_count": 0, + "following_count": 0, + "starred_repos_count": 1, + "username": "anbraten" + }, + "commit_id": "", + "review": null +} diff --git a/server/forge/gitea/fixtures/HookPullRequestMerged.json b/server/forge/gitea/fixtures/HookPullRequestMerged.json new file mode 100644 index 000000000..410e2f113 --- /dev/null +++ b/server/forge/gitea/fixtures/HookPullRequestMerged.json @@ -0,0 +1,378 @@ +{ + "action": "closed", + "number": 1, + "pull_request": { + "id": 62112, + "url": "https://gitea.com/anbraten/test-repo/pulls/1", + "number": 1, + "user": { + "id": 26907, + "login": "anbraten", + "login_name": "", + "full_name": "", + "email": "anbraten@noreply.gitea.com", + "avatar_url": "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", + "language": "", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2021-07-19T23:21:52Z", + "restricted": false, + "active": false, + "prohibit_login": false, + "location": "", + "website": "", + "description": "", + "visibility": "public", + "followers_count": 0, + "following_count": 0, + "starred_repos_count": 1, + "username": "anbraten" + }, + "title": "Adjust file", + "body": "", + "labels": [], + "milestone": null, + "assignee": null, + "assignees": null, + "requested_reviewers": null, + "state": "closed", + "is_locked": false, + "comments": 1, + "html_url": "https://gitea.com/anbraten/test-repo/pulls/1", + "diff_url": "https://gitea.com/anbraten/test-repo/pulls/1.diff", + "patch_url": "https://gitea.com/anbraten/test-repo/pulls/1.patch", + "mergeable": true, + "merged": true, + "merged_at": "2023-12-05T18:35:31Z", + "merge_commit_sha": "f2440f050054df0f8ecabcace648f1683509064c", + "merged_by": { + "id": 26907, + "login": "anbraten", + "login_name": "", + "full_name": "", + "email": "anbraten@noreply.gitea.com", + "avatar_url": "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", + "language": "", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2021-07-19T23:21:52Z", + "restricted": false, + "active": false, + "prohibit_login": false, + "location": "", + "website": "", + "description": "", + "visibility": "public", + "followers_count": 0, + "following_count": 0, + "starred_repos_count": 1, + "username": "anbraten" + }, + "allow_maintainer_edit": false, + "base": { + "label": "main", + "ref": "main", + "sha": "f2440f050054df0f8ecabcace648f1683509064c", + "repo_id": 46534, + "repo": { + "id": 46534, + "owner": { + "id": 26907, + "login": "anbraten", + "login_name": "", + "full_name": "", + "email": "anbraten@noreply.gitea.com", + "avatar_url": "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", + "language": "", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2021-07-19T23:21:52Z", + "restricted": false, + "active": false, + "prohibit_login": false, + "location": "", + "website": "", + "description": "", + "visibility": "public", + "followers_count": 0, + "following_count": 0, + "starred_repos_count": 1, + "username": "anbraten" + }, + "name": "test-repo", + "full_name": "anbraten/test-repo", + "description": "", + "empty": false, + "private": false, + "fork": false, + "template": false, + "parent": null, + "mirror": false, + "size": 26, + "language": "", + "languages_url": "https://gitea.com/api/v1/repos/anbraten/test-repo/languages", + "html_url": "https://gitea.com/anbraten/test-repo", + "url": "https://gitea.com/api/v1/repos/anbraten/test-repo", + "link": "", + "ssh_url": "git@gitea.com:anbraten/test-repo.git", + "clone_url": "https://gitea.com/anbraten/test-repo.git", + "original_url": "", + "website": "", + "stars_count": 0, + "forks_count": 0, + "watchers_count": 1, + "open_issues_count": 0, + "open_pr_counter": 1, + "release_counter": 0, + "default_branch": "main", + "archived": false, + "created_at": "2023-12-05T18:03:55Z", + "updated_at": "2023-12-05T18:06:29Z", + "archived_at": "1970-01-01T00:00:00Z", + "permissions": { + "admin": false, + "push": false, + "pull": true + }, + "has_issues": true, + "internal_tracker": { + "enable_time_tracker": true, + "allow_only_contributors_to_track_time": true, + "enable_issue_dependencies": true + }, + "has_wiki": true, + "has_pull_requests": true, + "has_projects": true, + "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_rebase_update": true, + "default_delete_branch_after_merge": false, + "default_merge_style": "merge", + "default_allow_maintainer_edit": false, + "avatar_url": "", + "internal": false, + "mirror_interval": "", + "mirror_updated": "0001-01-01T00:00:00Z", + "repo_transfer": null + } + }, + "head": { + "label": "anbraten-patch-1", + "ref": "anbraten-patch-1", + "sha": "d555a5dd07f4d0148a58d4686ec381502ae6a2d4", + "repo_id": 46534, + "repo": { + "id": 46534, + "owner": { + "id": 26907, + "login": "anbraten", + "login_name": "", + "full_name": "", + "email": "anbraten@noreply.gitea.com", + "avatar_url": "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", + "language": "", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2021-07-19T23:21:52Z", + "restricted": false, + "active": false, + "prohibit_login": false, + "location": "", + "website": "", + "description": "", + "visibility": "public", + "followers_count": 0, + "following_count": 0, + "starred_repos_count": 1, + "username": "anbraten" + }, + "name": "test-repo", + "full_name": "anbraten/test-repo", + "description": "", + "empty": false, + "private": false, + "fork": false, + "template": false, + "parent": null, + "mirror": false, + "size": 26, + "language": "", + "languages_url": "https://gitea.com/api/v1/repos/anbraten/test-repo/languages", + "html_url": "https://gitea.com/anbraten/test-repo", + "url": "https://gitea.com/api/v1/repos/anbraten/test-repo", + "link": "", + "ssh_url": "git@gitea.com:anbraten/test-repo.git", + "clone_url": "https://gitea.com/anbraten/test-repo.git", + "original_url": "", + "website": "", + "stars_count": 0, + "forks_count": 0, + "watchers_count": 1, + "open_issues_count": 0, + "open_pr_counter": 1, + "release_counter": 0, + "default_branch": "main", + "archived": false, + "created_at": "2023-12-05T18:03:55Z", + "updated_at": "2023-12-05T18:06:29Z", + "archived_at": "1970-01-01T00:00:00Z", + "permissions": { + "admin": false, + "push": false, + "pull": true + }, + "has_issues": true, + "internal_tracker": { + "enable_time_tracker": true, + "allow_only_contributors_to_track_time": true, + "enable_issue_dependencies": true + }, + "has_wiki": true, + "has_pull_requests": true, + "has_projects": true, + "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_rebase_update": true, + "default_delete_branch_after_merge": false, + "default_merge_style": "merge", + "default_allow_maintainer_edit": false, + "avatar_url": "", + "internal": false, + "mirror_interval": "", + "mirror_updated": "0001-01-01T00:00:00Z", + "repo_transfer": null + } + }, + "merge_base": "068aee163ffd44eef28a7f9ebd43e2c01774f0fa", + "due_date": null, + "created_at": "2023-12-05T18:06:38Z", + "updated_at": "2023-12-05T18:35:31Z", + "closed_at": "2023-12-05T18:35:31Z", + "pin_order": 0 + }, + "requested_reviewer": null, + "repository": { + "id": 46534, + "owner": { + "id": 26907, + "login": "anbraten", + "login_name": "", + "full_name": "", + "email": "anbraten@noreply.gitea.com", + "avatar_url": "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", + "language": "", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2021-07-19T23:21:52Z", + "restricted": false, + "active": false, + "prohibit_login": false, + "location": "", + "website": "", + "description": "", + "visibility": "public", + "followers_count": 0, + "following_count": 0, + "starred_repos_count": 1, + "username": "anbraten" + }, + "name": "test-repo", + "full_name": "anbraten/test-repo", + "description": "", + "empty": false, + "private": false, + "fork": false, + "template": false, + "parent": null, + "mirror": false, + "size": 26, + "language": "", + "languages_url": "https://gitea.com/api/v1/repos/anbraten/test-repo/languages", + "html_url": "https://gitea.com/anbraten/test-repo", + "url": "https://gitea.com/api/v1/repos/anbraten/test-repo", + "link": "", + "ssh_url": "git@gitea.com:anbraten/test-repo.git", + "clone_url": "https://gitea.com/anbraten/test-repo.git", + "original_url": "", + "website": "", + "stars_count": 0, + "forks_count": 0, + "watchers_count": 1, + "open_issues_count": 0, + "open_pr_counter": 1, + "release_counter": 0, + "default_branch": "main", + "archived": false, + "created_at": "2023-12-05T18:03:55Z", + "updated_at": "2023-12-05T18:06:29Z", + "archived_at": "1970-01-01T00:00:00Z", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "has_issues": true, + "internal_tracker": { + "enable_time_tracker": true, + "allow_only_contributors_to_track_time": true, + "enable_issue_dependencies": true + }, + "has_wiki": true, + "has_pull_requests": true, + "has_projects": true, + "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_rebase_update": true, + "default_delete_branch_after_merge": false, + "default_merge_style": "merge", + "default_allow_maintainer_edit": false, + "avatar_url": "", + "internal": false, + "mirror_interval": "", + "mirror_updated": "0001-01-01T00:00:00Z", + "repo_transfer": null + }, + "sender": { + "id": 26907, + "login": "anbraten", + "login_name": "", + "full_name": "", + "email": "anbraten@noreply.gitea.com", + "avatar_url": "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", + "language": "", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2021-07-19T23:21:52Z", + "restricted": false, + "active": false, + "prohibit_login": false, + "location": "", + "website": "", + "description": "", + "visibility": "public", + "followers_count": 0, + "following_count": 0, + "starred_repos_count": 1, + "username": "anbraten" + }, + "commit_id": "", + "review": null +} diff --git a/server/forge/gitea/fixtures/HookPullRequestUpdated.json b/server/forge/gitea/fixtures/HookPullRequestUpdated.json new file mode 100644 index 000000000..8e9e7b4aa --- /dev/null +++ b/server/forge/gitea/fixtures/HookPullRequestUpdated.json @@ -0,0 +1,137 @@ +{ + "action": "synchronized", + "number": 2, + "pull_request": { + "id": 2, + "url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets/pulls/2", + "number": 2, + "user": { + "id": 1, + "login": "test", + "login_name": "", + "full_name": "", + "email": "test@noreply.localhost", + "avatar_url": "http://127.0.0.1:3000/avatars/dd46a756faad4727fb679320751f6dea", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2023-07-31T19:13:05+02:00", + "visibility": "public", + "username": "test" + }, + "title": "New Pull", + "body": "create an awesome pull", + "labels": [ + { + "id": 8, + "name": "Kind/Bug", + "exclusive": false, + "is_archived": false, + "color": "ee0701", + "description": "Something is not working", + "url": "http://100.106.226.9:3000/api/v1/repos/Test-CI/multi-line-secrets/labels/8" + }, + { + "id": 11, + "name": "Kind/Security", + "exclusive": false, + "is_archived": false, + "color": "9c27b0", + "description": "This is security issue", + "url": "http://100.106.226.9:3000/api/v1/repos/Test-CI/multi-line-secrets/labels/11" + } + ], + "milestone": null, + "assignees": null, + "requested_reviewers": null, + "state": "open", + "is_locked": false, + "html_url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets/pulls/2", + "diff_url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets/pulls/2.diff", + "patch_url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets/pulls/2.patch", + "mergeable": true, + "merged": false, + "merged_at": null, + "merge_commit_sha": null, + "merged_by": null, + "base": { + "label": "main", + "ref": "main", + "sha": "29be01c073851cf0db0c6a466e396b725a670453", + "repo_id": 6 + }, + "head": { + "label": "test-patch-1", + "ref": "test-patch-1", + "sha": "788ed8d02d3b7fcfcf6386dbcbca696aa1d4dc25", + "repo_id": 6 + }, + "merge_base": "29be01c073851cf0db0c6a466e396b725a670453", + "due_date": null, + "created_at": "2024-02-22T01:38:39+01:00", + "updated_at": "2024-02-22T01:42:03+01:00", + "closed_at": null, + "pin_order": 0 + }, + "requested_reviewer": null, + "repository": { + "id": 6, + "owner": { + "id": 2, + "login": "Test-CI", + "login_name": "", + "full_name": "", + "email": "", + "avatar_url": "http://127.0.0.1:3000/avatars/5b0a83c2185b3cb1ebceb11062d6c2eb", + "language": "", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2023-07-31T19:13:48+02:00", + "prohibit_login": false, + "visibility": "public", + "username": "Test-CI" + }, + "name": "multi-line-secrets", + "full_name": "Test-CI/multi-line-secrets", + "description": "", + "private": false, + "languages_url": "http://127.0.0.1:3000/api/v1/repos/Test-CI/multi-line-secrets/languages", + "html_url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets", + "url": "http://127.0.0.1:3000/api/v1/repos/Test-CI/multi-line-secrets", + "link": "", + "ssh_url": "ssh://git@127.0.0.1:2200/Test-CI/multi-line-secrets.git", + "clone_url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets.git", + "original_url": "", + "default_branch": "main", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "has_issues": true, + "internal_tracker": { + "enable_time_tracker": true, + "allow_only_contributors_to_track_time": true, + "enable_issue_dependencies": true + }, + "has_pull_requests": true, + "avatar_url": "", + "internal": false, + "mirror_interval": "", + "object_format_name": "" + }, + "sender": { + "id": 1, + "login": "test", + "login_name": "", + "full_name": "", + "email": "test@noreply.localhost", + "avatar_url": "http://127.0.0.1:3000/avatars/dd46a756faad4727fb679320751f6dea", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2023-07-31T19:13:05+02:00", + "visibility": "public", + "username": "test" + }, + "commit_id": "", + "review": null +} diff --git a/server/forge/gitea/fixtures/HookPush.json b/server/forge/gitea/fixtures/HookPush.json new file mode 100644 index 000000000..460ddb39b --- /dev/null +++ b/server/forge/gitea/fixtures/HookPush.json @@ -0,0 +1,57 @@ +{ + "ref": "refs/heads/main", + "before": "4b2626259b5a97b6b4eab5e6cca66adb986b672b", + "after": "ef98532add3b2feb7a137426bba1248724367df5", + "compare_url": "http://gitea.golang.org/gordon/hello-world/compare/4b2626259b5a97b6b4eab5e6cca66adb986b672b...ef98532add3b2feb7a137426bba1248724367df5", + "commits": [ + { + "id": "ef98532add3b2feb7a137426bba1248724367df5", + "message": "bump\n", + "url": "http://gitea.golang.org/gordon/hello-world/commit/ef98532add3b2feb7a137426bba1248724367df5", + "author": { + "name": "Gordon the Gopher", + "email": "gordon@golang.org", + "username": "gordon" + }, + "added": ["CHANGELOG.md"], + "removed": [], + "modified": ["app/controller/application.rb"] + } + ], + "repository": { + "id": 1, + "name": "hello-world", + "full_name": "gordon/hello-world", + "html_url": "http://gitea.golang.org/gordon/hello-world", + "ssh_url": "git@gitea.golang.org:gordon/hello-world.git", + "clone_url": "http://gitea.golang.org/gordon/hello-world.git", + "description": "", + "website": "", + "watchers": 1, + "owner": { + "name": "gordon", + "email": "gordon@golang.org", + "login": "gordon", + "username": "gordon" + }, + "private": true, + "permissions": { + "admin": true, + "push": true, + "pull": true + } + }, + "pusher": { + "name": "gordon", + "email": "gordon@golang.org", + "username": "gordon", + "login": "gordon" + }, + "sender": { + "login": "gordon", + "id": 1, + "username": "gordon", + "email": "gordon@golang.org", + "avatar_url": "http://gitea.golang.org///1.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" + } +} diff --git a/server/forge/gitea/fixtures/HookPushBranch.json b/server/forge/gitea/fixtures/HookPushBranch.json new file mode 100644 index 000000000..653ac890c --- /dev/null +++ b/server/forge/gitea/fixtures/HookPushBranch.json @@ -0,0 +1,148 @@ +{ + "ref": "refs/heads/fdsafdsa", + "before": "0000000000000000000000000000000000000000", + "after": "28c3613ae62640216bea5e7dc71aa65356e4298b", + "compare_url": "https://codeberg.org/meisam/woodpecktester/compare/main...28c3613ae62640216bea5e7dc71aa65356e4298b", + "commits": [], + "head_commit": { + "id": "28c3613ae62640216bea5e7dc71aa65356e4298b", + "message": "Delete '.woodpecker/.check.yml'\n", + "url": "https://codeberg.org/meisam/woodpecktester/commit/28c3613ae62640216bea5e7dc71aa65356e4298b", + "author": { + "name": "meisam", + "email": "meisam@noreply.codeberg.org", + "username": "meisam" + }, + "committer": { + "name": "meisam", + "email": "meisam@noreply.codeberg.org", + "username": "meisam" + }, + "verification": null, + "timestamp": "2022-07-12T21:09:27+02:00", + "added": [], + "removed": [".woodpecker/.check.yml"], + "modified": [] + }, + "repository": { + "id": 50820, + "owner": { + "id": 14844, + "login": "meisam", + "full_name": "", + "email": "meisam@noreply.codeberg.org", + "avatar_url": "https://codeberg.org/avatars/96512da76a14cf44e0bb32d1640e878e", + "language": "", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2020-10-08T11:19:12+02:00", + "restricted": false, + "active": false, + "prohibit_login": false, + "location": "", + "website": "", + "description": "Materials engineer, physics enthusiast, large collection of the bad programming habits, always happy to fix the old ones and make new mistakes!", + "visibility": "public", + "followers_count": 0, + "following_count": 0, + "starred_repos_count": 0, + "username": "meisam", + "permissions": { + "admin": true, + "push": true, + "pull": true + } + }, + "name": "woodpecktester", + "full_name": "meisam/woodpecktester", + "description": "Just for testing the Woodpecker CI and reporting bugs", + "empty": false, + "private": false, + "fork": false, + "template": false, + "parent": null, + "mirror": false, + "size": 367, + "language": "", + "languages_url": "https://codeberg.org/api/v1/repos/meisam/woodpecktester/languages", + "html_url": "https://codeberg.org/meisam/woodpecktester", + "ssh_url": "git@codeberg.org:meisam/woodpecktester.git", + "clone_url": "https://codeberg.org/meisam/woodpecktester.git", + "original_url": "", + "website": "", + "stars_count": 0, + "forks_count": 0, + "watchers_count": 1, + "open_issues_count": 0, + "open_pr_counter": 0, + "release_counter": 0, + "default_branch": "main", + "archived": false, + "created_at": "2022-07-04T00:34:39+02:00", + "updated_at": "2022-07-24T20:31:29+02:00", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "has_issues": true, + "internal_tracker": { + "enable_time_tracker": true, + "allow_only_contributors_to_track_time": true, + "enable_issue_dependencies": true + }, + "has_wiki": true, + "has_pull_requests": true, + "has_projects": true, + "ignore_whitespace_conflicts": false, + "allow_merge_commits": true, + "allow_rebase": true, + "allow_rebase_explicit": true, + "allow_squash_merge": true, + "default_merge_style": "merge", + "avatar_url": "", + "internal": false, + "mirror_interval": "", + "mirror_updated": "0001-01-01T00:00:00Z", + "repo_transfer": null + }, + "pusher": { + "id": 2628, + "login": "6543", + "full_name": "", + "email": "6543@obermui.de", + "avatar_url": "https://codeberg.org/avatars/09a234c768cb9bca78f6b2f82d6af173", + "language": "", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2019-10-12T05:05:49+02:00", + "restricted": false, + "active": false, + "prohibit_login": false, + "location": "", + "visibility": "public", + "followers_count": 22, + "following_count": 16, + "starred_repos_count": 55, + "username": "6543" + }, + "sender": { + "id": 2628, + "login": "6543", + "full_name": "", + "email": "6543@obermui.de", + "avatar_url": "https://codeberg.org/avatars/09a234c768cb9bca78f6b2f82d6af173", + "language": "", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2019-10-12T05:05:49+02:00", + "restricted": false, + "active": false, + "prohibit_login": false, + "visibility": "public", + "followers_count": 22, + "following_count": 16, + "starred_repos_count": 55, + "username": "6543" + } +} diff --git a/server/forge/gitea/fixtures/HookPushMulti.json b/server/forge/gitea/fixtures/HookPushMulti.json new file mode 100644 index 000000000..dc2d49942 --- /dev/null +++ b/server/forge/gitea/fixtures/HookPushMulti.json @@ -0,0 +1,184 @@ +{ + "ref": "refs/heads/main", + "before": "6efcf5b7c98f3e7a491675164b7a2e7acac27941", + "after": "29be01c073851cf0db0c6a466e396b725a670453", + "compare_url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets/compare/6efcf5b7c98f3e7a491675164b7a2e7acac27941...29be01c073851cf0db0c6a466e396b725a670453", + "commits": [ + { + "id": "29be01c073851cf0db0c6a466e396b725a670453", + "message": "add some text\n", + "url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets/commit/29be01c073851cf0db0c6a466e396b725a670453", + "author": { + "name": "6543", + "email": "6543@obermui.de", + "username": "test-user" + }, + "committer": { + "name": "6543", + "email": "6543@obermui.de", + "username": "test-user" + }, + "verification": null, + "timestamp": "2024-02-22T00:18:07+01:00", + "added": [], + "removed": [], + "modified": ["aaa"] + }, + { + "id": "29cd95250404bd007c13b03eabe521196bab98a5", + "message": "rm a a file\n", + "url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets/commit/29cd95250404bd007c13b03eabe521196bab98a5", + "author": { + "name": "6543", + "email": "6543@obermui.de", + "username": "test-user" + }, + "committer": { + "name": "6543", + "email": "6543@obermui.de", + "username": "test-user" + }, + "verification": null, + "timestamp": "2024-02-22T00:17:49+01:00", + "added": [], + "removed": ["aa"], + "modified": [] + }, + { + "id": "93787b87b3134d0d62c7a24c1ea5b1b6fd17ca91", + "message": "add some a files\n", + "url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets/commit/93787b87b3134d0d62c7a24c1ea5b1b6fd17ca91", + "author": { + "name": "6543", + "email": "6543@obermui.de", + "username": "test-user" + }, + "committer": { + "name": "6543", + "email": "6543@obermui.de", + "username": "test-user" + }, + "verification": null, + "timestamp": "2024-02-22T00:17:33+01:00", + "added": ["aa", "aaa"], + "removed": [], + "modified": [] + } + ], + "total_commits": 3, + "head_commit": { + "id": "29be01c073851cf0db0c6a466e396b725a670453", + "message": "add some text\n", + "url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets/commit/29be01c073851cf0db0c6a466e396b725a670453", + "author": { + "name": "6543", + "email": "6543@obermui.de", + "username": "test-user" + }, + "committer": { + "name": "6543", + "email": "6543@obermui.de", + "username": "test-user" + }, + "verification": null, + "timestamp": "2024-02-22T00:18:07+01:00", + "added": [], + "removed": [], + "modified": ["aaa"] + }, + "repository": { + "id": 6, + "owner": { + "id": 2, + "login": "Test-CI", + "login_name": "", + "full_name": "", + "email": "", + "avatar_url": "http://127.0.0.1:3000/avatars/5b0a83c2185b3cb1ebceb11062d6c2eb", + "language": "", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2023-07-31T19:13:48+02:00", + "restricted": false, + "active": false, + "prohibit_login": false, + "location": "", + "website": "", + "description": "", + "visibility": "public", + "followers_count": 0, + "following_count": 0, + "starred_repos_count": 0, + "username": "Test-CI" + }, + "name": "multi-line-secrets", + "full_name": "Test-CI/multi-line-secrets", + "description": "", + "empty": false, + "private": false, + "fork": false, + "template": false, + "parent": null, + "mirror": false, + "size": 35, + "language": "", + "languages_url": "http://127.0.0.1:3000/api/v1/repos/Test-CI/multi-line-secrets/languages", + "html_url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets", + "url": "http://127.0.0.1:3000/api/v1/repos/Test-CI/multi-line-secrets", + "link": "", + "ssh_url": "ssh://git@127.0.0.1:2200/Test-CI/multi-line-secrets.git", + "clone_url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets.git", + "original_url": "", + "website": "", + "watchers_count": 2, + "open_issues_count": 1, + "default_branch": "main", + "archived": false, + "created_at": "2023-10-31T19:53:15+01:00", + "updated_at": "2023-11-02T06:16:34+01:00", + "archived_at": "1970-01-01T01:00:00+01:00", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "has_issues": true, + "internal_tracker": { + "enable_time_tracker": true, + "allow_only_contributors_to_track_time": true, + "enable_issue_dependencies": true + }, + "avatar_url": "", + "object_format_name": "" + }, + "pusher": { + "id": 1, + "login": "test-user", + "login_name": "", + "full_name": "", + "email": "test@noreply.localhost", + "avatar_url": "http://127.0.0.1:3000/avatars/dd46a756faad4727fb679320751f6dea", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2023-07-31T19:13:05+02:00", + "prohibit_login": false, + "description": "", + "visibility": "public", + "username": "test-user" + }, + "sender": { + "id": 1, + "login": "test-user", + "login_name": "", + "full_name": "", + "email": "test@noreply.localhost", + "avatar_url": "http://127.0.0.1:3000/avatars/dd46a756faad4727fb679320751f6dea", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2023-07-31T19:13:05+02:00", + "prohibit_login": false, + "description": "", + "visibility": "public", + "username": "test-user" + } +} diff --git a/server/forge/gitea/fixtures/HookRelease.json b/server/forge/gitea/fixtures/HookRelease.json new file mode 100644 index 000000000..3520ee0bb --- /dev/null +++ b/server/forge/gitea/fixtures/HookRelease.json @@ -0,0 +1,136 @@ +{ + "action": "published", + "release": { + "id": 48, + "tag_name": "0.0.5", + "target_commitish": "main", + "name": "Version 0.0.5", + "body": "", + "url": "https://git.xxx/api/v1/repos/anbraten/demo/releases/48", + "html_url": "https://git.xxx/anbraten/demo/releases/tag/0.0.5", + "tarball_url": "https://git.xxx/anbraten/demo/archive/0.0.5.tar.gz", + "zipball_url": "https://git.xxx/anbraten/demo/archive/0.0.5.zip", + "draft": false, + "prerelease": false, + "created_at": "2022-02-09T20:23:05Z", + "published_at": "2022-02-09T20:23:05Z", + "author": { + "id": 1, + "login": "anbraten", + "full_name": "Anton Bracke", + "email": "anbraten@noreply.xxx", + "avatar_url": "https://git.xxx/user/avatar/anbraten/-1", + "language": "", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2018-03-21T10:04:48Z", + "restricted": false, + "active": false, + "prohibit_login": false, + "location": "world", + "website": "https://xxx", + "description": "", + "visibility": "public", + "followers_count": 1, + "following_count": 1, + "starred_repos_count": 1, + "username": "anbraten" + }, + "assets": [] + }, + "repository": { + "id": 77, + "owner": { + "id": 1, + "login": "anbraten", + "full_name": "Anton Bracke", + "email": "anbraten@noreply.xxx", + "avatar_url": "https://git.xxx/user/avatar/anbraten/-1", + "language": "", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2018-03-21T10:04:48Z", + "restricted": false, + "active": false, + "prohibit_login": false, + "location": "world", + "website": "https://xxx", + "description": "", + "visibility": "public", + "followers_count": 1, + "following_count": 1, + "starred_repos_count": 1, + "username": "anbraten" + }, + "name": "demo", + "full_name": "anbraten/demo", + "description": "", + "empty": false, + "private": true, + "fork": false, + "template": false, + "parent": null, + "mirror": false, + "size": 59, + "html_url": "https://git.xxx/anbraten/demo", + "ssh_url": "ssh://git@git.xxx:22/anbraten/demo.git", + "clone_url": "https://git.xxx/anbraten/demo.git", + "original_url": "", + "website": "", + "stars_count": 0, + "forks_count": 1, + "watchers_count": 1, + "open_issues_count": 2, + "open_pr_counter": 2, + "release_counter": 4, + "default_branch": "main", + "archived": false, + "created_at": "2021-08-30T20:54:13Z", + "updated_at": "2022-01-09T01:29:23Z", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "has_issues": true, + "internal_tracker": { + "enable_time_tracker": true, + "allow_only_contributors_to_track_time": true, + "enable_issue_dependencies": true + }, + "has_wiki": false, + "has_pull_requests": true, + "has_projects": true, + "ignore_whitespace_conflicts": false, + "allow_merge_commits": true, + "allow_rebase": true, + "allow_rebase_explicit": true, + "allow_squash_merge": true, + "default_merge_style": "squash", + "avatar_url": "", + "internal": false, + "mirror_interval": "" + }, + "sender": { + "id": 1, + "login": "anbraten", + "full_name": "Anbraten", + "email": "anbraten@noreply.xxx", + "avatar_url": "https://git.xxx/user/avatar/anbraten/-1", + "language": "", + "is_admin": false, + "last_login": "0001-01-01T00:00:00Z", + "created": "2018-03-21T10:04:48Z", + "restricted": false, + "active": false, + "prohibit_login": false, + "location": "World", + "website": "https://xxx", + "description": "", + "visibility": "public", + "followers_count": 1, + "following_count": 1, + "starred_repos_count": 1, + "username": "anbraten" + } +} diff --git a/server/forge/gitea/fixtures/HookTag.json b/server/forge/gitea/fixtures/HookTag.json new file mode 100644 index 000000000..1c2decc7a --- /dev/null +++ b/server/forge/gitea/fixtures/HookTag.json @@ -0,0 +1,41 @@ +{ + "sha": "ef98532add3b2feb7a137426bba1248724367df5", + "secret": "l26Un7G7HXogLAvsyf2hOA4EMARSTsR3", + "ref": "v1.0.0", + "ref_type": "tag", + "repository": { + "id": 12, + "owner": { + "id": 4, + "username": "gordon", + "login": "gordon", + "full_name": "Gordon the Gopher", + "email": "gordon@golang.org", + "avatar_url": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" + }, + "name": "hello-world", + "full_name": "gordon/hello-world", + "description": "a hello world example", + "private": true, + "fork": false, + "html_url": "http://gitea.golang.org/gordon/hello-world", + "ssh_url": "git@gitea.golang.org:gordon/hello-world.git", + "clone_url": "http://gitea.golang.org/gordon/hello-world.git", + "default_branch": "main", + "created_at": "2015-10-22T19:32:44Z", + "updated_at": "2016-11-24T13:37:16Z", + "permissions": { + "admin": true, + "push": true, + "pull": true + } + }, + "sender": { + "id": 1, + "username": "gordon", + "login": "gordon", + "full_name": "Gordon the Gopher", + "email": "gordon@golang.org", + "avatar_url": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" + } +} diff --git a/server/forge/gitea/fixtures/hooks.go b/server/forge/gitea/fixtures/hooks.go index 2b151a62c..1395fdbb1 100644 --- a/server/forge/gitea/fixtures/hooks.go +++ b/server/forge/gitea/fixtures/hooks.go @@ -14,1470 +14,41 @@ package fixtures +import _ "embed" + // HookPush is a sample Gitea push hook. -const HookPush = ` -{ - "ref": "refs/heads/main", - "before": "4b2626259b5a97b6b4eab5e6cca66adb986b672b", - "after": "ef98532add3b2feb7a137426bba1248724367df5", - "compare_url": "http://gitea.golang.org/gordon/hello-world/compare/4b2626259b5a97b6b4eab5e6cca66adb986b672b...ef98532add3b2feb7a137426bba1248724367df5", - "commits": [ - { - "id": "ef98532add3b2feb7a137426bba1248724367df5", - "message": "bump\n", - "url": "http://gitea.golang.org/gordon/hello-world/commit/ef98532add3b2feb7a137426bba1248724367df5", - "author": { - "name": "Gordon the Gopher", - "email": "gordon@golang.org", - "username": "gordon" - }, - "added": ["CHANGELOG.md"], - "removed": [], - "modified": ["app/controller/application.rb"] - } - ], - "repository": { - "id": 1, - "name": "hello-world", - "full_name": "gordon/hello-world", - "html_url": "http://gitea.golang.org/gordon/hello-world", - "ssh_url": "git@gitea.golang.org:gordon/hello-world.git", - "clone_url": "http://gitea.golang.org/gordon/hello-world.git", - "description": "", - "website": "", - "watchers": 1, - "owner": { - "name": "gordon", - "email": "gordon@golang.org", - "login": "gordon", - "username": "gordon" - }, - "private": true, - "permissions": { - "admin": true, - "push": true, - "pull": true - } - }, - "pusher": { - "name": "gordon", - "email": "gordon@golang.org", - "username": "gordon", - "login": "gordon" - }, - "sender": { - "login": "gordon", - "id": 1, - "username": "gordon", - "email": "gordon@golang.org", - "avatar_url": "http://gitea.golang.org///1.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" - } -} -` +// +//go:embed HookPush.json +var HookPush string // HookPushMulti push multible commits to a branch. -const HookPushMulti = ` -{ - "ref": "refs/heads/main", - "before": "6efcf5b7c98f3e7a491675164b7a2e7acac27941", - "after": "29be01c073851cf0db0c6a466e396b725a670453", - "compare_url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets/compare/6efcf5b7c98f3e7a491675164b7a2e7acac27941...29be01c073851cf0db0c6a466e396b725a670453", - "commits": [ - { - "id": "29be01c073851cf0db0c6a466e396b725a670453", - "message": "add some text\n", - "url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets/commit/29be01c073851cf0db0c6a466e396b725a670453", - "author": { - "name": "6543", - "email": "6543@obermui.de", - "username": "test-user" - }, - "committer": { - "name": "6543", - "email": "6543@obermui.de", - "username": "test-user" - }, - "verification": null, - "timestamp": "2024-02-22T00:18:07+01:00", - "added": [], - "removed": [], - "modified": [ - "aaa" - ] - }, - { - "id": "29cd95250404bd007c13b03eabe521196bab98a5", - "message": "rm a a file\n", - "url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets/commit/29cd95250404bd007c13b03eabe521196bab98a5", - "author": { - "name": "6543", - "email": "6543@obermui.de", - "username": "test-user" - }, - "committer": { - "name": "6543", - "email": "6543@obermui.de", - "username": "test-user" - }, - "verification": null, - "timestamp": "2024-02-22T00:17:49+01:00", - "added": [], - "removed": [ - "aa" - ], - "modified": [] - }, - { - "id": "93787b87b3134d0d62c7a24c1ea5b1b6fd17ca91", - "message": "add some a files\n", - "url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets/commit/93787b87b3134d0d62c7a24c1ea5b1b6fd17ca91", - "author": { - "name": "6543", - "email": "6543@obermui.de", - "username": "test-user" - }, - "committer": { - "name": "6543", - "email": "6543@obermui.de", - "username": "test-user" - }, - "verification": null, - "timestamp": "2024-02-22T00:17:33+01:00", - "added": [ - "aa", - "aaa" - ], - "removed": [], - "modified": [] - } - ], - "total_commits": 3, - "head_commit": { - "id": "29be01c073851cf0db0c6a466e396b725a670453", - "message": "add some text\n", - "url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets/commit/29be01c073851cf0db0c6a466e396b725a670453", - "author": { - "name": "6543", - "email": "6543@obermui.de", - "username": "test-user" - }, - "committer": { - "name": "6543", - "email": "6543@obermui.de", - "username": "test-user" - }, - "verification": null, - "timestamp": "2024-02-22T00:18:07+01:00", - "added": [], - "removed": [], - "modified": [ - "aaa" - ] - }, - "repository": { - "id": 6, - "owner": { - "id": 2, - "login": "Test-CI", - "login_name": "", - "full_name": "", - "email": "", - "avatar_url": "http://127.0.0.1:3000/avatars/5b0a83c2185b3cb1ebceb11062d6c2eb", - "language": "", - "is_admin": false, - "last_login": "0001-01-01T00:00:00Z", - "created": "2023-07-31T19:13:48+02:00", - "restricted": false, - "active": false, - "prohibit_login": false, - "location": "", - "website": "", - "description": "", - "visibility": "public", - "followers_count": 0, - "following_count": 0, - "starred_repos_count": 0, - "username": "Test-CI" - }, - "name": "multi-line-secrets", - "full_name": "Test-CI/multi-line-secrets", - "description": "", - "empty": false, - "private": false, - "fork": false, - "template": false, - "parent": null, - "mirror": false, - "size": 35, - "language": "", - "languages_url": "http://127.0.0.1:3000/api/v1/repos/Test-CI/multi-line-secrets/languages", - "html_url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets", - "url": "http://127.0.0.1:3000/api/v1/repos/Test-CI/multi-line-secrets", - "link": "", - "ssh_url": "ssh://git@127.0.0.1:2200/Test-CI/multi-line-secrets.git", - "clone_url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets.git", - "original_url": "", - "website": "", - "watchers_count": 2, - "open_issues_count": 1, - "default_branch": "main", - "archived": false, - "created_at": "2023-10-31T19:53:15+01:00", - "updated_at": "2023-11-02T06:16:34+01:00", - "archived_at": "1970-01-01T01:00:00+01:00", - "permissions": { - "admin": true, - "push": true, - "pull": true - }, - "has_issues": true, - "internal_tracker": { - "enable_time_tracker": true, - "allow_only_contributors_to_track_time": true, - "enable_issue_dependencies": true - }, - "avatar_url": "", - "object_format_name": "" - }, - "pusher": { - "id": 1, - "login": "test-user", - "login_name": "", - "full_name": "", - "email": "test@noreply.localhost", - "avatar_url": "http://127.0.0.1:3000/avatars/dd46a756faad4727fb679320751f6dea", - "is_admin": false, - "last_login": "0001-01-01T00:00:00Z", - "created": "2023-07-31T19:13:05+02:00", - "prohibit_login": false, - "description": "", - "visibility": "public", - "username": "test-user" - }, - "sender": { - "id": 1, - "login": "test-user", - "login_name": "", - "full_name": "", - "email": "test@noreply.localhost", - "avatar_url": "http://127.0.0.1:3000/avatars/dd46a756faad4727fb679320751f6dea", - "is_admin": false, - "last_login": "0001-01-01T00:00:00Z", - "created": "2023-07-31T19:13:05+02:00", - "prohibit_login": false, - "description": "", - "visibility": "public", - "username": "test-user" - } -} -` +// +//go:embed HookPushMulti.json +var HookPushMulti string // HookPushBranch is a sample Gitea push hook where a new branch was created from an existing commit. -const HookPushBranch = ` -{ - "ref": "refs/heads/fdsafdsa", - "before": "0000000000000000000000000000000000000000", - "after": "28c3613ae62640216bea5e7dc71aa65356e4298b", - "compare_url": "https://codeberg.org/meisam/woodpecktester/compare/main...28c3613ae62640216bea5e7dc71aa65356e4298b", - "commits": [], - "head_commit": { - "id": "28c3613ae62640216bea5e7dc71aa65356e4298b", - "message": "Delete '.woodpecker/.check.yml'\n", - "url": "https://codeberg.org/meisam/woodpecktester/commit/28c3613ae62640216bea5e7dc71aa65356e4298b", - "author": { - "name": "meisam", - "email": "meisam@noreply.codeberg.org", - "username": "meisam" - }, - "committer": { - "name": "meisam", - "email": "meisam@noreply.codeberg.org", - "username": "meisam" - }, - "verification": null, - "timestamp": "2022-07-12T21:09:27+02:00", - "added": [], - "removed": [ - ".woodpecker/.check.yml" - ], - "modified": [] - }, - "repository": { - "id": 50820, - "owner": { - "id": 14844, - "login": "meisam", - "full_name": "", - "email": "meisam@noreply.codeberg.org", - "avatar_url": "https://codeberg.org/avatars/96512da76a14cf44e0bb32d1640e878e", - "language": "", - "is_admin": false, - "last_login": "0001-01-01T00:00:00Z", - "created": "2020-10-08T11:19:12+02:00", - "restricted": false, - "active": false, - "prohibit_login": false, - "location": "", - "website": "", - "description": "Materials engineer, physics enthusiast, large collection of the bad programming habits, always happy to fix the old ones and make new mistakes!", - "visibility": "public", - "followers_count": 0, - "following_count": 0, - "starred_repos_count": 0, - "username": "meisam", - "permissions": { - "admin": true, - "push": true, - "pull": true - } - }, - "name": "woodpecktester", - "full_name": "meisam/woodpecktester", - "description": "Just for testing the Woodpecker CI and reporting bugs", - "empty": false, - "private": false, - "fork": false, - "template": false, - "parent": null, - "mirror": false, - "size": 367, - "language": "", - "languages_url": "https://codeberg.org/api/v1/repos/meisam/woodpecktester/languages", - "html_url": "https://codeberg.org/meisam/woodpecktester", - "ssh_url": "git@codeberg.org:meisam/woodpecktester.git", - "clone_url": "https://codeberg.org/meisam/woodpecktester.git", - "original_url": "", - "website": "", - "stars_count": 0, - "forks_count": 0, - "watchers_count": 1, - "open_issues_count": 0, - "open_pr_counter": 0, - "release_counter": 0, - "default_branch": "main", - "archived": false, - "created_at": "2022-07-04T00:34:39+02:00", - "updated_at": "2022-07-24T20:31:29+02:00", - "permissions": { - "admin": true, - "push": true, - "pull": true - }, - "has_issues": true, - "internal_tracker": { - "enable_time_tracker": true, - "allow_only_contributors_to_track_time": true, - "enable_issue_dependencies": true - }, - "has_wiki": true, - "has_pull_requests": true, - "has_projects": true, - "ignore_whitespace_conflicts": false, - "allow_merge_commits": true, - "allow_rebase": true, - "allow_rebase_explicit": true, - "allow_squash_merge": true, - "default_merge_style": "merge", - "avatar_url": "", - "internal": false, - "mirror_interval": "", - "mirror_updated": "0001-01-01T00:00:00Z", - "repo_transfer": null - }, - "pusher": { - "id": 2628, - "login": "6543", - "full_name": "", - "email": "6543@obermui.de", - "avatar_url": "https://codeberg.org/avatars/09a234c768cb9bca78f6b2f82d6af173", - "language": "", - "is_admin": false, - "last_login": "0001-01-01T00:00:00Z", - "created": "2019-10-12T05:05:49+02:00", - "restricted": false, - "active": false, - "prohibit_login": false, - "location": "", - "visibility": "public", - "followers_count": 22, - "following_count": 16, - "starred_repos_count": 55, - "username": "6543" - }, - "sender": { - "id": 2628, - "login": "6543", - "full_name": "", - "email": "6543@obermui.de", - "avatar_url": "https://codeberg.org/avatars/09a234c768cb9bca78f6b2f82d6af173", - "language": "", - "is_admin": false, - "last_login": "0001-01-01T00:00:00Z", - "created": "2019-10-12T05:05:49+02:00", - "restricted": false, - "active": false, - "prohibit_login": false, - "visibility": "public", - "followers_count": 22, - "following_count": 16, - "starred_repos_count": 55, - "username": "6543" - } -}` +// +//go:embed HookPushBranch.json +var HookPushBranch string // HookTag is a sample Gitea tag hook. -const HookTag = `{ - "sha": "ef98532add3b2feb7a137426bba1248724367df5", - "secret": "l26Un7G7HXogLAvsyf2hOA4EMARSTsR3", - "ref": "v1.0.0", - "ref_type": "tag", - "repository": { - "id": 12, - "owner": { - "id": 4, - "username": "gordon", - "login": "gordon", - "full_name": "Gordon the Gopher", - "email": "gordon@golang.org", - "avatar_url": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" - }, - "name": "hello-world", - "full_name": "gordon/hello-world", - "description": "a hello world example", - "private": true, - "fork": false, - "html_url": "http://gitea.golang.org/gordon/hello-world", - "ssh_url": "git@gitea.golang.org:gordon/hello-world.git", - "clone_url": "http://gitea.golang.org/gordon/hello-world.git", - "default_branch": "main", - "created_at": "2015-10-22T19:32:44Z", - "updated_at": "2016-11-24T13:37:16Z", - "permissions": { - "admin": true, - "push": true, - "pull": true - } - }, - "sender": { - "id": 1, - "username": "gordon", - "login": "gordon", - "full_name": "Gordon the Gopher", - "email": "gordon@golang.org", - "avatar_url": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" - } -}` +// +//go:embed HookTag.json +var HookTag string // HookPullRequest is a sample pull_request webhook payload. -const HookPullRequest = `{ - "action": "opened", - "number": 1, - "pull_request": { - "html_url": "http://gitea.golang.org/gordon/hello-world/pull/1", - "state": "open", - "title": "Update the README with new information", - "body": "please merge", - "user": { - "id": 1, - "username": "gordon", - "login": "gordon", - "full_name": "Gordon the Gopher", - "email": "gordon@golang.org", - "avatar_url": "http://gitea.golang.org///1.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" - }, - "base": { - "label": "main", - "ref": "main", - "sha": "9353195a19e45482665306e466c832c46560532d" - }, - "head": { - "label": "feature/changes", - "ref": "feature/changes", - "sha": "0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c" - } - }, - "repository": { - "id": 35129377, - "name": "hello-world", - "full_name": "gordon/hello-world", - "owner": { - "id": 1, - "username": "gordon", - "login": "gordon", - "full_name": "Gordon the Gopher", - "email": "gordon@golang.org", - "avatar_url": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" - }, - "private": true, - "html_url": "http://gitea.golang.org/gordon/hello-world", - "clone_url": "https://gitea.golang.org/gordon/hello-world.git", - "default_branch": "main", - "permissions": { - "admin": true, - "push": true, - "pull": true - } - }, - "sender": { - "id": 1, - "login": "gordon", - "username": "gordon", - "full_name": "Gordon the Gopher", - "email": "gordon@golang.org", - "avatar_url": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" - } -}` +// +//go:embed HookPullRequest.json +var HookPullRequest string -const HookPullRequestUpdated = `{ - "action": "synchronized", - "number": 2, - "pull_request": { - "id": 2, - "url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets/pulls/2", - "number": 2, - "user": { - "id": 1, - "login": "test", - "login_name": "", - "full_name": "", - "email": "test@noreply.localhost", - "avatar_url": "http://127.0.0.1:3000/avatars/dd46a756faad4727fb679320751f6dea", - "is_admin": false, - "last_login": "0001-01-01T00:00:00Z", - "created": "2023-07-31T19:13:05+02:00", - "visibility": "public", - "username": "test" - }, - "title": "New Pull", - "body": "create an awesome pull", - "labels": [ - { - "id": 8, - "name": "Kind/Bug", - "exclusive": false, - "is_archived": false, - "color": "ee0701", - "description": "Something is not working", - "url": "http://100.106.226.9:3000/api/v1/repos/Test-CI/multi-line-secrets/labels/8" - }, - { - "id": 11, - "name": "Kind/Security", - "exclusive": false, - "is_archived": false, - "color": "9c27b0", - "description": "This is security issue", - "url": "http://100.106.226.9:3000/api/v1/repos/Test-CI/multi-line-secrets/labels/11" - } - ], - "milestone": null, - "assignees": null, - "requested_reviewers": null, - "state": "open", - "is_locked": false, - "html_url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets/pulls/2", - "diff_url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets/pulls/2.diff", - "patch_url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets/pulls/2.patch", - "mergeable": true, - "merged": false, - "merged_at": null, - "merge_commit_sha": null, - "merged_by": null, - "base": { - "label": "main", - "ref": "main", - "sha": "29be01c073851cf0db0c6a466e396b725a670453", - "repo_id": 6 - }, - "head": { - "label": "test-patch-1", - "ref": "test-patch-1", - "sha": "788ed8d02d3b7fcfcf6386dbcbca696aa1d4dc25", - "repo_id": 6 - }, - "merge_base": "29be01c073851cf0db0c6a466e396b725a670453", - "due_date": null, - "created_at": "2024-02-22T01:38:39+01:00", - "updated_at": "2024-02-22T01:42:03+01:00", - "closed_at": null, - "pin_order": 0 - }, - "requested_reviewer": null, - "repository": { - "id": 6, - "owner": { - "id": 2, - "login": "Test-CI", - "login_name": "", - "full_name": "", - "email": "", - "avatar_url": "http://127.0.0.1:3000/avatars/5b0a83c2185b3cb1ebceb11062d6c2eb", - "language": "", - "is_admin": false, - "last_login": "0001-01-01T00:00:00Z", - "created": "2023-07-31T19:13:48+02:00", - "prohibit_login": false, - "visibility": "public", - "username": "Test-CI" - }, - "name": "multi-line-secrets", - "full_name": "Test-CI/multi-line-secrets", - "description": "", - "private": false, - "languages_url": "http://127.0.0.1:3000/api/v1/repos/Test-CI/multi-line-secrets/languages", - "html_url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets", - "url": "http://127.0.0.1:3000/api/v1/repos/Test-CI/multi-line-secrets", - "link": "", - "ssh_url": "ssh://git@127.0.0.1:2200/Test-CI/multi-line-secrets.git", - "clone_url": "http://127.0.0.1:3000/Test-CI/multi-line-secrets.git", - "original_url": "", - "default_branch": "main", - "permissions": { - "admin": true, - "push": true, - "pull": true - }, - "has_issues": true, - "internal_tracker": { - "enable_time_tracker": true, - "allow_only_contributors_to_track_time": true, - "enable_issue_dependencies": true - }, - "has_pull_requests": true, - "avatar_url": "", - "internal": false, - "mirror_interval": "", - "object_format_name": "" - }, - "sender": { - "id": 1, - "login": "test", - "login_name": "", - "full_name": "", - "email": "test@noreply.localhost", - "avatar_url": "http://127.0.0.1:3000/avatars/dd46a756faad4727fb679320751f6dea", - "is_admin": false, - "last_login": "0001-01-01T00:00:00Z", - "created": "2023-07-31T19:13:05+02:00", - "visibility": "public", - "username": "test" - }, - "commit_id": "", - "review": null -}` +//go:embed HookPullRequestUpdated.json +var HookPullRequestUpdated string -const HookPullRequestMerged = ` -{ - "action": "closed", - "number": 1, - "pull_request": { - "id": 62112, - "url": "https://gitea.com/anbraten/test-repo/pulls/1", - "number": 1, - "user": { - "id": 26907, - "login": "anbraten", - "login_name": "", - "full_name": "", - "email": "anbraten@noreply.gitea.com", - "avatar_url": "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", - "language": "", - "is_admin": false, - "last_login": "0001-01-01T00:00:00Z", - "created": "2021-07-19T23:21:52Z", - "restricted": false, - "active": false, - "prohibit_login": false, - "location": "", - "website": "", - "description": "", - "visibility": "public", - "followers_count": 0, - "following_count": 0, - "starred_repos_count": 1, - "username": "anbraten" - }, - "title": "Adjust file", - "body": "", - "labels": [], - "milestone": null, - "assignee": null, - "assignees": null, - "requested_reviewers": null, - "state": "closed", - "is_locked": false, - "comments": 1, - "html_url": "https://gitea.com/anbraten/test-repo/pulls/1", - "diff_url": "https://gitea.com/anbraten/test-repo/pulls/1.diff", - "patch_url": "https://gitea.com/anbraten/test-repo/pulls/1.patch", - "mergeable": true, - "merged": true, - "merged_at": "2023-12-05T18:35:31Z", - "merge_commit_sha": "f2440f050054df0f8ecabcace648f1683509064c", - "merged_by": { - "id": 26907, - "login": "anbraten", - "login_name": "", - "full_name": "", - "email": "anbraten@noreply.gitea.com", - "avatar_url": "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", - "language": "", - "is_admin": false, - "last_login": "0001-01-01T00:00:00Z", - "created": "2021-07-19T23:21:52Z", - "restricted": false, - "active": false, - "prohibit_login": false, - "location": "", - "website": "", - "description": "", - "visibility": "public", - "followers_count": 0, - "following_count": 0, - "starred_repos_count": 1, - "username": "anbraten" - }, - "allow_maintainer_edit": false, - "base": { - "label": "main", - "ref": "main", - "sha": "f2440f050054df0f8ecabcace648f1683509064c", - "repo_id": 46534, - "repo": { - "id": 46534, - "owner": { - "id": 26907, - "login": "anbraten", - "login_name": "", - "full_name": "", - "email": "anbraten@noreply.gitea.com", - "avatar_url": "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", - "language": "", - "is_admin": false, - "last_login": "0001-01-01T00:00:00Z", - "created": "2021-07-19T23:21:52Z", - "restricted": false, - "active": false, - "prohibit_login": false, - "location": "", - "website": "", - "description": "", - "visibility": "public", - "followers_count": 0, - "following_count": 0, - "starred_repos_count": 1, - "username": "anbraten" - }, - "name": "test-repo", - "full_name": "anbraten/test-repo", - "description": "", - "empty": false, - "private": false, - "fork": false, - "template": false, - "parent": null, - "mirror": false, - "size": 26, - "language": "", - "languages_url": "https://gitea.com/api/v1/repos/anbraten/test-repo/languages", - "html_url": "https://gitea.com/anbraten/test-repo", - "url": "https://gitea.com/api/v1/repos/anbraten/test-repo", - "link": "", - "ssh_url": "git@gitea.com:anbraten/test-repo.git", - "clone_url": "https://gitea.com/anbraten/test-repo.git", - "original_url": "", - "website": "", - "stars_count": 0, - "forks_count": 0, - "watchers_count": 1, - "open_issues_count": 0, - "open_pr_counter": 1, - "release_counter": 0, - "default_branch": "main", - "archived": false, - "created_at": "2023-12-05T18:03:55Z", - "updated_at": "2023-12-05T18:06:29Z", - "archived_at": "1970-01-01T00:00:00Z", - "permissions": { - "admin": false, - "push": false, - "pull": true - }, - "has_issues": true, - "internal_tracker": { - "enable_time_tracker": true, - "allow_only_contributors_to_track_time": true, - "enable_issue_dependencies": true - }, - "has_wiki": true, - "has_pull_requests": true, - "has_projects": true, - "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_rebase_update": true, - "default_delete_branch_after_merge": false, - "default_merge_style": "merge", - "default_allow_maintainer_edit": false, - "avatar_url": "", - "internal": false, - "mirror_interval": "", - "mirror_updated": "0001-01-01T00:00:00Z", - "repo_transfer": null - } - }, - "head": { - "label": "anbraten-patch-1", - "ref": "anbraten-patch-1", - "sha": "d555a5dd07f4d0148a58d4686ec381502ae6a2d4", - "repo_id": 46534, - "repo": { - "id": 46534, - "owner": { - "id": 26907, - "login": "anbraten", - "login_name": "", - "full_name": "", - "email": "anbraten@noreply.gitea.com", - "avatar_url": "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", - "language": "", - "is_admin": false, - "last_login": "0001-01-01T00:00:00Z", - "created": "2021-07-19T23:21:52Z", - "restricted": false, - "active": false, - "prohibit_login": false, - "location": "", - "website": "", - "description": "", - "visibility": "public", - "followers_count": 0, - "following_count": 0, - "starred_repos_count": 1, - "username": "anbraten" - }, - "name": "test-repo", - "full_name": "anbraten/test-repo", - "description": "", - "empty": false, - "private": false, - "fork": false, - "template": false, - "parent": null, - "mirror": false, - "size": 26, - "language": "", - "languages_url": "https://gitea.com/api/v1/repos/anbraten/test-repo/languages", - "html_url": "https://gitea.com/anbraten/test-repo", - "url": "https://gitea.com/api/v1/repos/anbraten/test-repo", - "link": "", - "ssh_url": "git@gitea.com:anbraten/test-repo.git", - "clone_url": "https://gitea.com/anbraten/test-repo.git", - "original_url": "", - "website": "", - "stars_count": 0, - "forks_count": 0, - "watchers_count": 1, - "open_issues_count": 0, - "open_pr_counter": 1, - "release_counter": 0, - "default_branch": "main", - "archived": false, - "created_at": "2023-12-05T18:03:55Z", - "updated_at": "2023-12-05T18:06:29Z", - "archived_at": "1970-01-01T00:00:00Z", - "permissions": { - "admin": false, - "push": false, - "pull": true - }, - "has_issues": true, - "internal_tracker": { - "enable_time_tracker": true, - "allow_only_contributors_to_track_time": true, - "enable_issue_dependencies": true - }, - "has_wiki": true, - "has_pull_requests": true, - "has_projects": true, - "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_rebase_update": true, - "default_delete_branch_after_merge": false, - "default_merge_style": "merge", - "default_allow_maintainer_edit": false, - "avatar_url": "", - "internal": false, - "mirror_interval": "", - "mirror_updated": "0001-01-01T00:00:00Z", - "repo_transfer": null - } - }, - "merge_base": "068aee163ffd44eef28a7f9ebd43e2c01774f0fa", - "due_date": null, - "created_at": "2023-12-05T18:06:38Z", - "updated_at": "2023-12-05T18:35:31Z", - "closed_at": "2023-12-05T18:35:31Z", - "pin_order": 0 - }, - "requested_reviewer": null, - "repository": { - "id": 46534, - "owner": { - "id": 26907, - "login": "anbraten", - "login_name": "", - "full_name": "", - "email": "anbraten@noreply.gitea.com", - "avatar_url": "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", - "language": "", - "is_admin": false, - "last_login": "0001-01-01T00:00:00Z", - "created": "2021-07-19T23:21:52Z", - "restricted": false, - "active": false, - "prohibit_login": false, - "location": "", - "website": "", - "description": "", - "visibility": "public", - "followers_count": 0, - "following_count": 0, - "starred_repos_count": 1, - "username": "anbraten" - }, - "name": "test-repo", - "full_name": "anbraten/test-repo", - "description": "", - "empty": false, - "private": false, - "fork": false, - "template": false, - "parent": null, - "mirror": false, - "size": 26, - "language": "", - "languages_url": "https://gitea.com/api/v1/repos/anbraten/test-repo/languages", - "html_url": "https://gitea.com/anbraten/test-repo", - "url": "https://gitea.com/api/v1/repos/anbraten/test-repo", - "link": "", - "ssh_url": "git@gitea.com:anbraten/test-repo.git", - "clone_url": "https://gitea.com/anbraten/test-repo.git", - "original_url": "", - "website": "", - "stars_count": 0, - "forks_count": 0, - "watchers_count": 1, - "open_issues_count": 0, - "open_pr_counter": 1, - "release_counter": 0, - "default_branch": "main", - "archived": false, - "created_at": "2023-12-05T18:03:55Z", - "updated_at": "2023-12-05T18:06:29Z", - "archived_at": "1970-01-01T00:00:00Z", - "permissions": { - "admin": true, - "push": true, - "pull": true - }, - "has_issues": true, - "internal_tracker": { - "enable_time_tracker": true, - "allow_only_contributors_to_track_time": true, - "enable_issue_dependencies": true - }, - "has_wiki": true, - "has_pull_requests": true, - "has_projects": true, - "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_rebase_update": true, - "default_delete_branch_after_merge": false, - "default_merge_style": "merge", - "default_allow_maintainer_edit": false, - "avatar_url": "", - "internal": false, - "mirror_interval": "", - "mirror_updated": "0001-01-01T00:00:00Z", - "repo_transfer": null - }, - "sender": { - "id": 26907, - "login": "anbraten", - "login_name": "", - "full_name": "", - "email": "anbraten@noreply.gitea.com", - "avatar_url": "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", - "language": "", - "is_admin": false, - "last_login": "0001-01-01T00:00:00Z", - "created": "2021-07-19T23:21:52Z", - "restricted": false, - "active": false, - "prohibit_login": false, - "location": "", - "website": "", - "description": "", - "visibility": "public", - "followers_count": 0, - "following_count": 0, - "starred_repos_count": 1, - "username": "anbraten" - }, - "commit_id": "", - "review": null -} -` +//go:embed HookPullRequestMerged.json +var HookPullRequestMerged string -const HookPullRequestClosed = ` -{ - "action": "closed", - "number": 1, - "pull_request": { - "id": 62112, - "url": "https://gitea.com/anbraten/test-repo/pulls/1", - "number": 1, - "user": { - "id": 26907, - "login": "anbraten", - "login_name": "", - "full_name": "", - "email": "anbraten@gitea.com", - "avatar_url": "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", - "language": "", - "is_admin": false, - "last_login": "0001-01-01T00:00:00Z", - "created": "2021-07-19T23:21:52Z", - "restricted": false, - "active": false, - "prohibit_login": false, - "location": "", - "website": "", - "description": "", - "visibility": "public", - "followers_count": 0, - "following_count": 0, - "starred_repos_count": 1, - "username": "anbraten" - }, - "title": "Adjust file", - "body": "", - "labels": [], - "milestone": null, - "assignee": null, - "assignees": null, - "requested_reviewers": null, - "state": "closed", - "is_locked": false, - "comments": 0, - "html_url": "https://gitea.com/anbraten/test-repo/pulls/1", - "diff_url": "https://gitea.com/anbraten/test-repo/pulls/1.diff", - "patch_url": "https://gitea.com/anbraten/test-repo/pulls/1.patch", - "mergeable": true, - "merged": false, - "merged_at": null, - "merge_commit_sha": null, - "merged_by": null, - "allow_maintainer_edit": false, - "base": { - "label": "main", - "ref": "main", - "sha": "068aee163ffd44eef28a7f9ebd43e2c01774f0fa", - "repo_id": 46534, - "repo": { - "id": 46534, - "owner": { - "id": 26907, - "login": "anbraten", - "login_name": "", - "full_name": "", - "email": "anbraten@noreply.gitea.com", - "avatar_url": "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", - "language": "", - "is_admin": false, - "last_login": "0001-01-01T00:00:00Z", - "created": "2021-07-19T23:21:52Z", - "restricted": false, - "active": false, - "prohibit_login": false, - "location": "", - "website": "", - "description": "", - "visibility": "public", - "followers_count": 0, - "following_count": 0, - "starred_repos_count": 1, - "username": "anbraten" - }, - "name": "test-repo", - "full_name": "anbraten/test-repo", - "description": "", - "empty": false, - "private": false, - "fork": false, - "template": false, - "parent": null, - "mirror": false, - "size": 26, - "language": "", - "languages_url": "https://gitea.com/api/v1/repos/anbraten/test-repo/languages", - "html_url": "https://gitea.com/anbraten/test-repo", - "url": "https://gitea.com/api/v1/repos/anbraten/test-repo", - "link": "", - "ssh_url": "git@gitea.com:anbraten/test-repo.git", - "clone_url": "https://gitea.com/anbraten/test-repo.git", - "original_url": "", - "website": "", - "stars_count": 0, - "forks_count": 0, - "watchers_count": 1, - "open_issues_count": 0, - "open_pr_counter": 1, - "release_counter": 0, - "default_branch": "main", - "archived": false, - "created_at": "2023-12-05T18:03:55Z", - "updated_at": "2023-12-05T18:06:29Z", - "archived_at": "1970-01-01T00:00:00Z", - "permissions": { - "admin": false, - "push": false, - "pull": true - }, - "has_issues": true, - "internal_tracker": { - "enable_time_tracker": true, - "allow_only_contributors_to_track_time": true, - "enable_issue_dependencies": true - }, - "has_wiki": true, - "has_pull_requests": true, - "has_projects": true, - "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_rebase_update": true, - "default_delete_branch_after_merge": false, - "default_merge_style": "merge", - "default_allow_maintainer_edit": false, - "avatar_url": "", - "internal": false, - "mirror_interval": "", - "mirror_updated": "0001-01-01T00:00:00Z", - "repo_transfer": null - } - }, - "head": { - "label": "anbraten-patch-1", - "ref": "anbraten-patch-1", - "sha": "d555a5dd07f4d0148a58d4686ec381502ae6a2d4", - "repo_id": 46534, - "repo": { - "id": 46534, - "owner": { - "id": 26907, - "login": "anbraten", - "login_name": "", - "full_name": "", - "email": "anbraten@noreply.gitea.com", - "avatar_url": "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", - "language": "", - "is_admin": false, - "last_login": "0001-01-01T00:00:00Z", - "created": "2021-07-19T23:21:52Z", - "restricted": false, - "active": false, - "prohibit_login": false, - "location": "", - "website": "", - "description": "", - "visibility": "public", - "followers_count": 0, - "following_count": 0, - "starred_repos_count": 1, - "username": "anbraten" - }, - "name": "test-repo", - "full_name": "anbraten/test-repo", - "description": "", - "empty": false, - "private": false, - "fork": false, - "template": false, - "parent": null, - "mirror": false, - "size": 26, - "language": "", - "languages_url": "https://gitea.com/api/v1/repos/anbraten/test-repo/languages", - "html_url": "https://gitea.com/anbraten/test-repo", - "url": "https://gitea.com/api/v1/repos/anbraten/test-repo", - "link": "", - "ssh_url": "git@gitea.com:anbraten/test-repo.git", - "clone_url": "https://gitea.com/anbraten/test-repo.git", - "original_url": "", - "website": "", - "stars_count": 0, - "forks_count": 0, - "watchers_count": 1, - "open_issues_count": 0, - "open_pr_counter": 1, - "release_counter": 0, - "default_branch": "main", - "archived": false, - "created_at": "2023-12-05T18:03:55Z", - "updated_at": "2023-12-05T18:06:29Z", - "archived_at": "1970-01-01T00:00:00Z", - "permissions": { - "admin": false, - "push": false, - "pull": true - }, - "has_issues": true, - "internal_tracker": { - "enable_time_tracker": true, - "allow_only_contributors_to_track_time": true, - "enable_issue_dependencies": true - }, - "has_wiki": true, - "has_pull_requests": true, - "has_projects": true, - "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_rebase_update": true, - "default_delete_branch_after_merge": false, - "default_merge_style": "merge", - "default_allow_maintainer_edit": false, - "avatar_url": "", - "internal": false, - "mirror_interval": "", - "mirror_updated": "0001-01-01T00:00:00Z", - "repo_transfer": null - } - }, - "merge_base": "068aee163ffd44eef28a7f9ebd43e2c01774f0fa", - "due_date": null, - "created_at": "2023-12-05T18:06:38Z", - "updated_at": "2023-12-05T18:06:43Z", - "closed_at": "2023-12-05T18:06:43Z", - "pin_order": 0 - }, - "requested_reviewer": null, - "repository": { - "id": 46534, - "owner": { - "id": 26907, - "login": "anbraten", - "login_name": "", - "full_name": "", - "email": "anbraten@repo.gitea.com", - "avatar_url": "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", - "language": "", - "is_admin": false, - "last_login": "0001-01-01T00:00:00Z", - "created": "2021-07-19T23:21:52Z", - "restricted": false, - "active": false, - "prohibit_login": false, - "location": "", - "website": "", - "description": "", - "visibility": "public", - "followers_count": 0, - "following_count": 0, - "starred_repos_count": 1, - "username": "anbraten" - }, - "name": "test-repo", - "full_name": "anbraten/test-repo", - "description": "", - "empty": false, - "private": false, - "fork": false, - "template": false, - "parent": null, - "mirror": false, - "size": 26, - "language": "", - "languages_url": "https://gitea.com/api/v1/repos/anbraten/test-repo/languages", - "html_url": "https://gitea.com/anbraten/test-repo", - "url": "https://gitea.com/api/v1/repos/anbraten/test-repo", - "link": "", - "ssh_url": "git@gitea.com:anbraten/test-repo.git", - "clone_url": "https://gitea.com/anbraten/test-repo.git", - "original_url": "", - "website": "", - "stars_count": 0, - "forks_count": 0, - "watchers_count": 1, - "open_issues_count": 0, - "open_pr_counter": 1, - "release_counter": 0, - "default_branch": "main", - "archived": false, - "created_at": "2023-12-05T18:03:55Z", - "updated_at": "2023-12-05T18:06:29Z", - "archived_at": "1970-01-01T00:00:00Z", - "permissions": { - "admin": true, - "push": true, - "pull": true - }, - "has_issues": true, - "internal_tracker": { - "enable_time_tracker": true, - "allow_only_contributors_to_track_time": true, - "enable_issue_dependencies": true - }, - "has_wiki": true, - "has_pull_requests": true, - "has_projects": true, - "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_rebase_update": true, - "default_delete_branch_after_merge": false, - "default_merge_style": "merge", - "default_allow_maintainer_edit": false, - "avatar_url": "", - "internal": false, - "mirror_interval": "", - "mirror_updated": "0001-01-01T00:00:00Z", - "repo_transfer": null - }, - "sender": { - "id": 26907, - "login": "anbraten", - "login_name": "", - "full_name": "", - "email": "anbraten@sender.gitea.com", - "avatar_url": "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", - "language": "", - "is_admin": false, - "last_login": "0001-01-01T00:00:00Z", - "created": "2021-07-19T23:21:52Z", - "restricted": false, - "active": false, - "prohibit_login": false, - "location": "", - "website": "", - "description": "", - "visibility": "public", - "followers_count": 0, - "following_count": 0, - "starred_repos_count": 1, - "username": "anbraten" - }, - "commit_id": "", - "review": null -} -` +//go:embed HookPullRequestClosed.json +var HookPullRequestClosed string -const HookRelease = ` -{ - "action": "published", - "release": { - "id": 48, - "tag_name": "0.0.5", - "target_commitish": "main", - "name": "Version 0.0.5", - "body": "", - "url": "https://git.xxx/api/v1/repos/anbraten/demo/releases/48", - "html_url": "https://git.xxx/anbraten/demo/releases/tag/0.0.5", - "tarball_url": "https://git.xxx/anbraten/demo/archive/0.0.5.tar.gz", - "zipball_url": "https://git.xxx/anbraten/demo/archive/0.0.5.zip", - "draft": false, - "prerelease": false, - "created_at": "2022-02-09T20:23:05Z", - "published_at": "2022-02-09T20:23:05Z", - "author": {"id":1,"login":"anbraten","full_name":"Anton Bracke","email":"anbraten@noreply.xxx","avatar_url":"https://git.xxx/user/avatar/anbraten/-1","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2018-03-21T10:04:48Z","restricted":false,"active":false,"prohibit_login":false,"location":"world","website":"https://xxx","description":"","visibility":"public","followers_count":1,"following_count":1,"starred_repos_count":1,"username":"anbraten"}, - "assets": [] - }, - "repository": { - "id": 77, - "owner": {"id":1,"login":"anbraten","full_name":"Anton Bracke","email":"anbraten@noreply.xxx","avatar_url":"https://git.xxx/user/avatar/anbraten/-1","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2018-03-21T10:04:48Z","restricted":false,"active":false,"prohibit_login":false,"location":"world","website":"https://xxx","description":"","visibility":"public","followers_count":1,"following_count":1,"starred_repos_count":1,"username":"anbraten"}, - "name": "demo", - "full_name": "anbraten/demo", - "description": "", - "empty": false, - "private": true, - "fork": false, - "template": false, - "parent": null, - "mirror": false, - "size": 59, - "html_url": "https://git.xxx/anbraten/demo", - "ssh_url": "ssh://git@git.xxx:22/anbraten/demo.git", - "clone_url": "https://git.xxx/anbraten/demo.git", - "original_url": "", - "website": "", - "stars_count": 0, - "forks_count": 1, - "watchers_count": 1, - "open_issues_count": 2, - "open_pr_counter": 2, - "release_counter": 4, - "default_branch": "main", - "archived": false, - "created_at": "2021-08-30T20:54:13Z", - "updated_at": "2022-01-09T01:29:23Z", - "permissions": { - "admin": true, - "push": true, - "pull": true - }, - "has_issues": true, - "internal_tracker": { - "enable_time_tracker": true, - "allow_only_contributors_to_track_time": true, - "enable_issue_dependencies": true - }, - "has_wiki": false, - "has_pull_requests": true, - "has_projects": true, - "ignore_whitespace_conflicts": false, - "allow_merge_commits": true, - "allow_rebase": true, - "allow_rebase_explicit": true, - "allow_squash_merge": true, - "default_merge_style": "squash", - "avatar_url": "", - "internal": false, - "mirror_interval": "" - }, - "sender": {"id":1,"login":"anbraten","full_name":"Anbraten","email":"anbraten@noreply.xxx","avatar_url":"https://git.xxx/user/avatar/anbraten/-1","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2018-03-21T10:04:48Z","restricted":false,"active":false,"prohibit_login":false,"location":"World","website":"https://xxx","description":"","visibility":"public","followers_count":1,"following_count":1,"starred_repos_count":1,"username":"anbraten"} -} -` +//go:embed HookRelease.json +var HookRelease string