.
This commit is contained in:
parent
aadb57588c
commit
f23a2b2a50
@ -841,3 +841,362 @@ const createTagJSON=`{
|
|||||||
}`
|
}`
|
||||||
|
|
||||||
|
|
||||||
|
const createIssueJSON = `{
|
||||||
|
"action": "opened",
|
||||||
|
"number": 1,
|
||||||
|
"issue": {
|
||||||
|
"id": 97139,
|
||||||
|
"url": "https://src.opensuse.org/api/v1/repos/importtest/_ObsPrj/issues/1",
|
||||||
|
"html_url": "https://src.opensuse.org/importtest/_ObsPrj/issues/1",
|
||||||
|
"number": 1,
|
||||||
|
"user": {
|
||||||
|
"id": 129,
|
||||||
|
"login": "adamm",
|
||||||
|
"login_name": "f79f87ba6073af67d93d1afdf5ed4c9326032010c8002647f737a67d438232e8",
|
||||||
|
"source_id": 9,
|
||||||
|
"full_name": "Adam Majer",
|
||||||
|
"email": "amajer@suse.com",
|
||||||
|
"avatar_url": "https://src.opensuse.org/avatar/babb6ae054a709c238a4e9b0f2b53d53",
|
||||||
|
"html_url": "https://src.opensuse.org/adamm",
|
||||||
|
"language": "en-US",
|
||||||
|
"is_admin": false,
|
||||||
|
"last_login": "2024-08-23T23:13:43+02:00",
|
||||||
|
"created": "2023-07-21T16:43:48+02:00",
|
||||||
|
"restricted": false,
|
||||||
|
"active": true,
|
||||||
|
"prohibit_login": false,
|
||||||
|
"location": "",
|
||||||
|
"website": "",
|
||||||
|
"description": "",
|
||||||
|
"visibility": "public",
|
||||||
|
"followers_count": 0,
|
||||||
|
"following_count": 0,
|
||||||
|
"starred_repos_count": 0,
|
||||||
|
"username": "adamm"
|
||||||
|
},
|
||||||
|
"original_author": "",
|
||||||
|
"original_author_id": 0,
|
||||||
|
"title": "test",
|
||||||
|
"body": "test",
|
||||||
|
"ref": "",
|
||||||
|
"assets": [],
|
||||||
|
"labels": [],
|
||||||
|
"milestone": null,
|
||||||
|
"assignee": null,
|
||||||
|
"assignees": null,
|
||||||
|
"state": "open",
|
||||||
|
"is_locked": false,
|
||||||
|
"comments": 0,
|
||||||
|
"created_at": "2024-08-24T21:51:47+02:00",
|
||||||
|
"updated_at": "2024-08-24T21:51:47+02:00",
|
||||||
|
"closed_at": null,
|
||||||
|
"due_date": null,
|
||||||
|
"pull_request": null,
|
||||||
|
"repository": {
|
||||||
|
"id": 90991,
|
||||||
|
"name": "_ObsPrj",
|
||||||
|
"owner": "importtest",
|
||||||
|
"full_name": "importtest/_ObsPrj"
|
||||||
|
},
|
||||||
|
"pin_order": 0
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"id": 90991,
|
||||||
|
"owner": {
|
||||||
|
"id": 939,
|
||||||
|
"login": "importtest",
|
||||||
|
"login_name": "",
|
||||||
|
"source_id": 0,
|
||||||
|
"full_name": "",
|
||||||
|
"email": "",
|
||||||
|
"avatar_url": "https://src.opensuse.org/avatars/10dc780b6dc535d772efc579e47b5acd",
|
||||||
|
"html_url": "https://src.opensuse.org/importtest",
|
||||||
|
"language": "",
|
||||||
|
"is_admin": false,
|
||||||
|
"last_login": "0001-01-01T00:00:00Z",
|
||||||
|
"created": "2024-03-07T13:35:42+01:00",
|
||||||
|
"restricted": false,
|
||||||
|
"active": false,
|
||||||
|
"prohibit_login": false,
|
||||||
|
"location": "",
|
||||||
|
"website": "",
|
||||||
|
"description": "",
|
||||||
|
"visibility": "public",
|
||||||
|
"followers_count": 0,
|
||||||
|
"following_count": 0,
|
||||||
|
"starred_repos_count": 0,
|
||||||
|
"username": "importtest"
|
||||||
|
},
|
||||||
|
"name": "_ObsPrj",
|
||||||
|
"full_name": "importtest/_ObsPrj",
|
||||||
|
"description": "",
|
||||||
|
"empty": false,
|
||||||
|
"private": false,
|
||||||
|
"fork": false,
|
||||||
|
"template": false,
|
||||||
|
"parent": null,
|
||||||
|
"mirror": false,
|
||||||
|
"size": 30,
|
||||||
|
"language": "",
|
||||||
|
"languages_url": "https://src.opensuse.org/api/v1/repos/importtest/_ObsPrj/languages",
|
||||||
|
"html_url": "https://src.opensuse.org/importtest/_ObsPrj",
|
||||||
|
"url": "https://src.opensuse.org/api/v1/repos/importtest/_ObsPrj",
|
||||||
|
"link": "",
|
||||||
|
"ssh_url": "gitea@src.opensuse.org:importtest/_ObsPrj.git",
|
||||||
|
"clone_url": "https://src.opensuse.org/importtest/_ObsPrj.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": "2024-08-22T18:01:09+02:00",
|
||||||
|
"updated_at": "2024-08-24T18:12:37+02: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": false,
|
||||||
|
"allow_only_contributors_to_track_time": true,
|
||||||
|
"enable_issue_dependencies": true
|
||||||
|
},
|
||||||
|
"has_wiki": true,
|
||||||
|
"has_pull_requests": true,
|
||||||
|
"has_projects": true,
|
||||||
|
"projects_mode": "all",
|
||||||
|
"has_releases": true,
|
||||||
|
"has_packages": true,
|
||||||
|
"has_actions": true,
|
||||||
|
"ignore_whitespace_conflicts": false,
|
||||||
|
"allow_merge_commits": true,
|
||||||
|
"allow_rebase": true,
|
||||||
|
"allow_rebase_explicit": true,
|
||||||
|
"allow_squash_merge": true,
|
||||||
|
"allow_fast_forward_only_merge": true,
|
||||||
|
"allow_rebase_update": true,
|
||||||
|
"default_delete_branch_after_merge": false,
|
||||||
|
"default_merge_style": "merge",
|
||||||
|
"default_allow_maintainer_edit": false,
|
||||||
|
"avatar_url": "https://src.opensuse.org/",
|
||||||
|
"internal": false,
|
||||||
|
"mirror_interval": "",
|
||||||
|
"object_format_name": "sha256",
|
||||||
|
"mirror_updated": "0001-01-01T00:00:00Z",
|
||||||
|
"repo_transfer": null
|
||||||
|
},
|
||||||
|
"sender": {
|
||||||
|
"id": 129,
|
||||||
|
"login": "adamm",
|
||||||
|
"login_name": "",
|
||||||
|
"source_id": 0,
|
||||||
|
"full_name": "Adam Majer",
|
||||||
|
"email": "adamm@noreply@src.opensuse.org",
|
||||||
|
"avatar_url": "https://src.opensuse.org/avatar/babb6ae054a709c238a4e9b0f2b53d53",
|
||||||
|
"html_url": "https://src.opensuse.org/adamm",
|
||||||
|
"language": "",
|
||||||
|
"is_admin": false,
|
||||||
|
"last_login": "0001-01-01T00:00:00Z",
|
||||||
|
"created": "2023-07-21T16:43: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": "adamm"
|
||||||
|
},
|
||||||
|
"commit_id": ""
|
||||||
|
}`
|
||||||
|
|
||||||
|
|
||||||
|
const issueAssignJSON = `{
|
||||||
|
"action": "unassigned",
|
||||||
|
"number": 1,
|
||||||
|
"issue": {
|
||||||
|
"id": 97139,
|
||||||
|
"url": "https://src.opensuse.org/api/v1/repos/importtest/_ObsPrj/issues/1",
|
||||||
|
"html_url": "https://src.opensuse.org/importtest/_ObsPrj/issues/1",
|
||||||
|
"number": 1,
|
||||||
|
"user": {
|
||||||
|
"id": 129,
|
||||||
|
"login": "adamm",
|
||||||
|
"login_name": "f79f87ba6073af67d93d1afdf5ed4c9326032010c8002647f737a67d438232e8",
|
||||||
|
"source_id": 9,
|
||||||
|
"full_name": "Adam Majer",
|
||||||
|
"email": "amajer@suse.com",
|
||||||
|
"avatar_url": "https://src.opensuse.org/avatar/babb6ae054a709c238a4e9b0f2b53d53",
|
||||||
|
"html_url": "https://src.opensuse.org/adamm",
|
||||||
|
"language": "en-US",
|
||||||
|
"is_admin": false,
|
||||||
|
"last_login": "2024-08-23T23:13:43+02:00",
|
||||||
|
"created": "2023-07-21T16:43:48+02:00",
|
||||||
|
"restricted": false,
|
||||||
|
"active": true,
|
||||||
|
"prohibit_login": false,
|
||||||
|
"location": "",
|
||||||
|
"website": "",
|
||||||
|
"description": "",
|
||||||
|
"visibility": "public",
|
||||||
|
"followers_count": 0,
|
||||||
|
"following_count": 0,
|
||||||
|
"starred_repos_count": 0,
|
||||||
|
"username": "adamm"
|
||||||
|
},
|
||||||
|
"original_author": "",
|
||||||
|
"original_author_id": 0,
|
||||||
|
"title": "test",
|
||||||
|
"body": "test 2",
|
||||||
|
"ref": "",
|
||||||
|
"assets": [],
|
||||||
|
"labels": [],
|
||||||
|
"milestone": null,
|
||||||
|
"assignee": null,
|
||||||
|
"assignees": null,
|
||||||
|
"state": "closed",
|
||||||
|
"is_locked": false,
|
||||||
|
"comments": 1,
|
||||||
|
"created_at": "2024-08-24T21:51:47+02:00",
|
||||||
|
"updated_at": "2024-08-24T22:07:40+02:00",
|
||||||
|
"closed_at": "2024-08-24T22:06:20+02:00",
|
||||||
|
"due_date": null,
|
||||||
|
"pull_request": null,
|
||||||
|
"repository": {
|
||||||
|
"id": 90991,
|
||||||
|
"name": "_ObsPrj",
|
||||||
|
"owner": "importtest",
|
||||||
|
"full_name": "importtest/_ObsPrj"
|
||||||
|
},
|
||||||
|
"pin_order": 0
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"id": 90991,
|
||||||
|
"owner": {
|
||||||
|
"id": 939,
|
||||||
|
"login": "importtest",
|
||||||
|
"login_name": "",
|
||||||
|
"source_id": 0,
|
||||||
|
"full_name": "",
|
||||||
|
"email": "",
|
||||||
|
"avatar_url": "https://src.opensuse.org/avatars/10dc780b6dc535d772efc579e47b5acd",
|
||||||
|
"html_url": "https://src.opensuse.org/importtest",
|
||||||
|
"language": "",
|
||||||
|
"is_admin": false,
|
||||||
|
"last_login": "0001-01-01T00:00:00Z",
|
||||||
|
"created": "2024-03-07T13:35:42+01:00",
|
||||||
|
"restricted": false,
|
||||||
|
"active": false,
|
||||||
|
"prohibit_login": false,
|
||||||
|
"location": "",
|
||||||
|
"website": "",
|
||||||
|
"description": "",
|
||||||
|
"visibility": "public",
|
||||||
|
"followers_count": 0,
|
||||||
|
"following_count": 0,
|
||||||
|
"starred_repos_count": 0,
|
||||||
|
"username": "importtest"
|
||||||
|
},
|
||||||
|
"name": "_ObsPrj",
|
||||||
|
"full_name": "importtest/_ObsPrj",
|
||||||
|
"description": "",
|
||||||
|
"empty": false,
|
||||||
|
"private": false,
|
||||||
|
"fork": false,
|
||||||
|
"template": false,
|
||||||
|
"parent": null,
|
||||||
|
"mirror": false,
|
||||||
|
"size": 30,
|
||||||
|
"language": "",
|
||||||
|
"languages_url": "https://src.opensuse.org/api/v1/repos/importtest/_ObsPrj/languages",
|
||||||
|
"html_url": "https://src.opensuse.org/importtest/_ObsPrj",
|
||||||
|
"url": "https://src.opensuse.org/api/v1/repos/importtest/_ObsPrj",
|
||||||
|
"link": "",
|
||||||
|
"ssh_url": "gitea@src.opensuse.org:importtest/_ObsPrj.git",
|
||||||
|
"clone_url": "https://src.opensuse.org/importtest/_ObsPrj.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": "2024-08-22T18:01:09+02:00",
|
||||||
|
"updated_at": "2024-08-24T18:12:37+02: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": false,
|
||||||
|
"allow_only_contributors_to_track_time": true,
|
||||||
|
"enable_issue_dependencies": true
|
||||||
|
},
|
||||||
|
"has_wiki": true,
|
||||||
|
"has_pull_requests": true,
|
||||||
|
"has_projects": true,
|
||||||
|
"projects_mode": "all",
|
||||||
|
"has_releases": true,
|
||||||
|
"has_packages": true,
|
||||||
|
"has_actions": true,
|
||||||
|
"ignore_whitespace_conflicts": false,
|
||||||
|
"allow_merge_commits": true,
|
||||||
|
"allow_rebase": true,
|
||||||
|
"allow_rebase_explicit": true,
|
||||||
|
"allow_squash_merge": true,
|
||||||
|
"allow_fast_forward_only_merge": true,
|
||||||
|
"allow_rebase_update": true,
|
||||||
|
"default_delete_branch_after_merge": false,
|
||||||
|
"default_merge_style": "merge",
|
||||||
|
"default_allow_maintainer_edit": false,
|
||||||
|
"avatar_url": "https://src.opensuse.org/",
|
||||||
|
"internal": false,
|
||||||
|
"mirror_interval": "",
|
||||||
|
"object_format_name": "sha256",
|
||||||
|
"mirror_updated": "0001-01-01T00:00:00Z",
|
||||||
|
"repo_transfer": null
|
||||||
|
},
|
||||||
|
"sender": {
|
||||||
|
"id": 129,
|
||||||
|
"login": "adamm",
|
||||||
|
"login_name": "",
|
||||||
|
"source_id": 0,
|
||||||
|
"full_name": "Adam Majer",
|
||||||
|
"email": "adamm@noreply@src.opensuse.org",
|
||||||
|
"avatar_url": "https://src.opensuse.org/avatar/babb6ae054a709c238a4e9b0f2b53d53",
|
||||||
|
"html_url": "https://src.opensuse.org/adamm",
|
||||||
|
"language": "",
|
||||||
|
"is_admin": false,
|
||||||
|
"last_login": "0001-01-01T00:00:00Z",
|
||||||
|
"created": "2023-07-21T16:43: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": "adamm"
|
||||||
|
},
|
||||||
|
"commit_id": ""
|
||||||
|
}`
|
||||||
|
|
||||||
|
@ -8,6 +8,9 @@ type IssueDetail struct {
|
|||||||
Title string
|
Title string
|
||||||
Body string
|
Body string
|
||||||
State string
|
State string
|
||||||
|
|
||||||
|
Assignee *User
|
||||||
|
Assignees []*User
|
||||||
}
|
}
|
||||||
|
|
||||||
type IssueWebhookEvent struct {
|
type IssueWebhookEvent struct {
|
||||||
|
@ -110,6 +110,24 @@ func parseRequestJSON(reqType string, data []byte) (org *common.Organization, ex
|
|||||||
org = issue.Repository.Owner
|
org = issue.Repository.Owner
|
||||||
extraAction = issue.Action
|
extraAction = issue.Action
|
||||||
|
|
||||||
|
case "issue_assign":
|
||||||
|
issue := common.IssueWebhookEvent{}
|
||||||
|
if err = json.Unmarshal(data, &issue); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
switch issue.Action {
|
||||||
|
case "assign", "unassign":
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
err = fmt.Errorf("Unknown Issue Assign webhook action type: %s", issue.Action)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
org = issue.Repository.Owner
|
||||||
|
extraAction = issue.Action
|
||||||
|
|
||||||
|
// case "issue_comment":
|
||||||
|
// case "issue_labelled":
|
||||||
|
|
||||||
default:
|
default:
|
||||||
err = fmt.Errorf("Unknown webhook request type: %s", reqType)
|
err = fmt.Errorf("Unknown webhook request type: %s", reqType)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user