mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-04-15 01:41:56 +00:00
Add pull request closed event (#2684)
- [x] updates docs - [x] adjust UI - [x] show correct icon - [x] show correct link (to pr) - [x] add as option in secret edit - [x] parse webhook - [x] update tests - [x] github merged - [x] github closed - [x] gitea merged - [x] gitea closed - [x] bitbucket merged - [x] bitbucket closed - [x] gitlab merged - [x] gitlab closed closes #286
This commit is contained in:
+291
-6
@@ -31,8 +31,9 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
// ServiceHookPushBody is payload of ServiceHook: Push
|
||||
var ServiceHookPushBody = []byte(`{
|
||||
// HookPush is payload of a push event
|
||||
var HookPush = []byte(`
|
||||
{
|
||||
"object_kind": "push",
|
||||
"event_name": "push",
|
||||
"before": "ffe8eb4f91d1fe6bc49f1e610e50e4b5767f0104",
|
||||
@@ -100,8 +101,9 @@ var ServiceHookPushBody = []byte(`{
|
||||
}
|
||||
}`)
|
||||
|
||||
// ServiceHookTagPushBody is payload of ServiceHook: TagPush
|
||||
var ServiceHookTagPushBody = []byte(`{
|
||||
// HookTag is payload of a TAG event
|
||||
var HookTag = []byte(`
|
||||
{
|
||||
"object_kind": "tag_push",
|
||||
"event_name": "tag_push",
|
||||
"before": "0000000000000000000000000000000000000000",
|
||||
@@ -169,8 +171,9 @@ var ServiceHookTagPushBody = []byte(`{
|
||||
}
|
||||
}`)
|
||||
|
||||
// WebhookMergeRequestBody is payload of MergeEvent
|
||||
var WebhookMergeRequestBody = []byte(`{
|
||||
// HookPullRequest is payload of a PULL_REQUEST event
|
||||
var HookPullRequest = []byte(`
|
||||
{
|
||||
"object_kind": "merge_request",
|
||||
"event_type": "merge_request",
|
||||
"user": {
|
||||
@@ -314,3 +317,285 @@ var WebhookMergeRequestBody = []byte(`{
|
||||
]
|
||||
}
|
||||
`)
|
||||
|
||||
var HookPullRequestClosed = []byte(`
|
||||
{
|
||||
"object_kind": "merge_request",
|
||||
"event_type": "merge_request",
|
||||
"user": {
|
||||
"id": 2251488,
|
||||
"name": "Anbraten",
|
||||
"username": "anbraten",
|
||||
"avatar_url": "https://secure.gravatar.com/avatar/fc9b6fe77c6b732a02925a62a81f05a0?s=80&d=identicon",
|
||||
"email": "[REDACTED]"
|
||||
},
|
||||
"project": {
|
||||
"id": 32059612,
|
||||
"name": "woodpecker-test",
|
||||
"description": "",
|
||||
"web_url": "https://gitlab.com/anbraten/woodpecker-test",
|
||||
"avatar_url": null,
|
||||
"git_ssh_url": "git@gitlab.com:anbraten/woodpecker-test.git",
|
||||
"git_http_url": "https://gitlab.com/anbraten/woodpecker-test.git",
|
||||
"namespace": "Anbraten",
|
||||
"visibility_level": 20,
|
||||
"path_with_namespace": "anbraten/woodpecker-test",
|
||||
"default_branch": "main",
|
||||
"ci_config_path": "",
|
||||
"homepage": "https://gitlab.com/anbraten/woodpecker-test",
|
||||
"url": "git@gitlab.com:anbraten/woodpecker-test.git",
|
||||
"ssh_url": "git@gitlab.com:anbraten/woodpecker-test.git",
|
||||
"http_url": "https://gitlab.com/anbraten/woodpecker-test.git"
|
||||
},
|
||||
"object_attributes": {
|
||||
"assignee_id": null,
|
||||
"author_id": 2251488,
|
||||
"created_at": "2023-12-05 18:40:22 UTC",
|
||||
"description": "",
|
||||
"draft": false,
|
||||
"head_pipeline_id": null,
|
||||
"id": 268189426,
|
||||
"iid": 4,
|
||||
"last_edited_at": null,
|
||||
"last_edited_by_id": null,
|
||||
"merge_commit_sha": null,
|
||||
"merge_error": null,
|
||||
"merge_params": {
|
||||
"force_remove_source_branch": "1"
|
||||
},
|
||||
"merge_status": "can_be_merged",
|
||||
"merge_user_id": null,
|
||||
"merge_when_pipeline_succeeds": false,
|
||||
"milestone_id": null,
|
||||
"source_branch": "patch-1",
|
||||
"source_project_id": 32059612,
|
||||
"state_id": 2,
|
||||
"target_branch": "main",
|
||||
"target_project_id": 32059612,
|
||||
"time_estimate": 0,
|
||||
"title": "Add new file",
|
||||
"updated_at": "2023-12-05 18:40:34 UTC",
|
||||
"updated_by_id": null,
|
||||
"url": "https://gitlab.com/anbraten/woodpecker-test/-/merge_requests/4",
|
||||
"source": {
|
||||
"id": 32059612,
|
||||
"name": "woodpecker-test",
|
||||
"description": "",
|
||||
"web_url": "https://gitlab.com/anbraten/woodpecker-test",
|
||||
"avatar_url": null,
|
||||
"git_ssh_url": "git@gitlab.com:anbraten/woodpecker-test.git",
|
||||
"git_http_url": "https://gitlab.com/anbraten/woodpecker-test.git",
|
||||
"namespace": "Anbraten",
|
||||
"visibility_level": 20,
|
||||
"path_with_namespace": "anbraten/woodpecker-test",
|
||||
"default_branch": "main",
|
||||
"ci_config_path": "",
|
||||
"homepage": "https://gitlab.com/anbraten/woodpecker-test",
|
||||
"url": "git@gitlab.com:anbraten/woodpecker-test.git",
|
||||
"ssh_url": "git@gitlab.com:anbraten/woodpecker-test.git",
|
||||
"http_url": "https://gitlab.com/anbraten/woodpecker-test.git"
|
||||
},
|
||||
"target": {
|
||||
"id": 32059612,
|
||||
"name": "woodpecker-test",
|
||||
"description": "",
|
||||
"web_url": "https://gitlab.com/anbraten/woodpecker-test",
|
||||
"avatar_url": null,
|
||||
"git_ssh_url": "git@gitlab.com:anbraten/woodpecker-test.git",
|
||||
"git_http_url": "https://gitlab.com/anbraten/woodpecker-test.git",
|
||||
"namespace": "Anbraten",
|
||||
"visibility_level": 20,
|
||||
"path_with_namespace": "anbraten/woodpecker-test",
|
||||
"default_branch": "main",
|
||||
"ci_config_path": "",
|
||||
"homepage": "https://gitlab.com/anbraten/woodpecker-test",
|
||||
"url": "git@gitlab.com:anbraten/woodpecker-test.git",
|
||||
"ssh_url": "git@gitlab.com:anbraten/woodpecker-test.git",
|
||||
"http_url": "https://gitlab.com/anbraten/woodpecker-test.git"
|
||||
},
|
||||
"last_commit": {
|
||||
"id": "3e4db3586b65dd401de8c77b3ac343fd24cbf89b",
|
||||
"message": "Add new file",
|
||||
"title": "Add new file",
|
||||
"timestamp": "2023-12-05T18:39:57+00:00",
|
||||
"url": "https://gitlab.com/anbraten/woodpecker-test/-/commit/3e4db3586b65dd401de8c77b3ac343fd24cbf89b",
|
||||
"author": {
|
||||
"name": "Anbraten",
|
||||
"email": "[redacted]"
|
||||
}
|
||||
},
|
||||
"work_in_progress": false,
|
||||
"total_time_spent": 0,
|
||||
"time_change": 0,
|
||||
"human_total_time_spent": null,
|
||||
"human_time_change": null,
|
||||
"human_time_estimate": null,
|
||||
"assignee_ids": [],
|
||||
"reviewer_ids": [],
|
||||
"labels": [],
|
||||
"state": "closed",
|
||||
"blocking_discussions_resolved": true,
|
||||
"first_contribution": false,
|
||||
"detailed_merge_status": "not_open",
|
||||
"action": "close"
|
||||
},
|
||||
"labels": [],
|
||||
"changes": {
|
||||
"state_id": {
|
||||
"previous": 1,
|
||||
"current": 2
|
||||
},
|
||||
"updated_at": {
|
||||
"previous": "2023-12-05 18:40:28 UTC",
|
||||
"current": "2023-12-05 18:40:34 UTC"
|
||||
}
|
||||
},
|
||||
"repository": {
|
||||
"name": "woodpecker-test",
|
||||
"url": "git@gitlab.com:anbraten/woodpecker-test.git",
|
||||
"description": "",
|
||||
"homepage": "https://gitlab.com/anbraten/woodpecker-test"
|
||||
}
|
||||
}
|
||||
`)
|
||||
|
||||
var HookPullRequestMerged = []byte(`
|
||||
{
|
||||
"object_kind": "merge_request",
|
||||
"event_type": "merge_request",
|
||||
"user": {
|
||||
"id": 2251488,
|
||||
"name": "Anbraten",
|
||||
"username": "anbraten",
|
||||
"avatar_url": "https://secure.gravatar.com/avatar/fc9b6fe77c6b732a02925a62a81f05a0?s=80&d=identicon",
|
||||
"email": "[REDACTED]"
|
||||
},
|
||||
"project": {
|
||||
"id": 32059612,
|
||||
"name": "woodpecker-test",
|
||||
"description": "",
|
||||
"web_url": "https://gitlab.com/anbraten/woodpecker-test",
|
||||
"avatar_url": null,
|
||||
"git_ssh_url": "git@gitlab.com:anbraten/woodpecker-test.git",
|
||||
"git_http_url": "https://gitlab.com/anbraten/woodpecker-test.git",
|
||||
"namespace": "Anbraten",
|
||||
"visibility_level": 20,
|
||||
"path_with_namespace": "anbraten/woodpecker-test",
|
||||
"default_branch": "main",
|
||||
"ci_config_path": "",
|
||||
"homepage": "https://gitlab.com/anbraten/woodpecker-test",
|
||||
"url": "git@gitlab.com:anbraten/woodpecker-test.git",
|
||||
"ssh_url": "git@gitlab.com:anbraten/woodpecker-test.git",
|
||||
"http_url": "https://gitlab.com/anbraten/woodpecker-test.git"
|
||||
},
|
||||
"object_attributes": {
|
||||
"assignee_id": null,
|
||||
"author_id": 2251488,
|
||||
"created_at": "2023-12-05 18:40:22 UTC",
|
||||
"description": "",
|
||||
"draft": false,
|
||||
"head_pipeline_id": null,
|
||||
"id": 268189426,
|
||||
"iid": 4,
|
||||
"last_edited_at": null,
|
||||
"last_edited_by_id": null,
|
||||
"merge_commit_sha": "43411b53d670203e887c4985c4e58e8e6b7c109e",
|
||||
"merge_error": null,
|
||||
"merge_params": {
|
||||
"force_remove_source_branch": "1"
|
||||
},
|
||||
"merge_status": "can_be_merged",
|
||||
"merge_user_id": null,
|
||||
"merge_when_pipeline_succeeds": false,
|
||||
"milestone_id": null,
|
||||
"source_branch": "patch-1",
|
||||
"source_project_id": 32059612,
|
||||
"state_id": 3,
|
||||
"target_branch": "main",
|
||||
"target_project_id": 32059612,
|
||||
"time_estimate": 0,
|
||||
"title": "Add new file",
|
||||
"updated_at": "2023-12-05 18:43:00 UTC",
|
||||
"updated_by_id": null,
|
||||
"url": "https://gitlab.com/anbraten/woodpecker-test/-/merge_requests/4",
|
||||
"source": {
|
||||
"id": 32059612,
|
||||
"name": "woodpecker-test",
|
||||
"description": "",
|
||||
"web_url": "https://gitlab.com/anbraten/woodpecker-test",
|
||||
"avatar_url": null,
|
||||
"git_ssh_url": "git@gitlab.com:anbraten/woodpecker-test.git",
|
||||
"git_http_url": "https://gitlab.com/anbraten/woodpecker-test.git",
|
||||
"namespace": "Anbraten",
|
||||
"visibility_level": 20,
|
||||
"path_with_namespace": "anbraten/woodpecker-test",
|
||||
"default_branch": "main",
|
||||
"ci_config_path": "",
|
||||
"homepage": "https://gitlab.com/anbraten/woodpecker-test",
|
||||
"url": "git@gitlab.com:anbraten/woodpecker-test.git",
|
||||
"ssh_url": "git@gitlab.com:anbraten/woodpecker-test.git",
|
||||
"http_url": "https://gitlab.com/anbraten/woodpecker-test.git"
|
||||
},
|
||||
"target": {
|
||||
"id": 32059612,
|
||||
"name": "woodpecker-test",
|
||||
"description": "",
|
||||
"web_url": "https://gitlab.com/anbraten/woodpecker-test",
|
||||
"avatar_url": null,
|
||||
"git_ssh_url": "git@gitlab.com:anbraten/woodpecker-test.git",
|
||||
"git_http_url": "https://gitlab.com/anbraten/woodpecker-test.git",
|
||||
"namespace": "Anbraten",
|
||||
"visibility_level": 20,
|
||||
"path_with_namespace": "anbraten/woodpecker-test",
|
||||
"default_branch": "main",
|
||||
"ci_config_path": "",
|
||||
"homepage": "https://gitlab.com/anbraten/woodpecker-test",
|
||||
"url": "git@gitlab.com:anbraten/woodpecker-test.git",
|
||||
"ssh_url": "git@gitlab.com:anbraten/woodpecker-test.git",
|
||||
"http_url": "https://gitlab.com/anbraten/woodpecker-test.git"
|
||||
},
|
||||
"last_commit": {
|
||||
"id": "3e4db3586b65dd401de8c77b3ac343fd24cbf89b",
|
||||
"message": "Add new file",
|
||||
"title": "Add new file",
|
||||
"timestamp": "2023-12-05T18:39:57+00:00",
|
||||
"url": "https://gitlab.com/anbraten/woodpecker-test/-/commit/3e4db3586b65dd401de8c77b3ac343fd24cbf89b",
|
||||
"author": {
|
||||
"name": "Anbraten",
|
||||
"email": "[redacted]"
|
||||
}
|
||||
},
|
||||
"work_in_progress": false,
|
||||
"total_time_spent": 0,
|
||||
"time_change": 0,
|
||||
"human_total_time_spent": null,
|
||||
"human_time_change": null,
|
||||
"human_time_estimate": null,
|
||||
"assignee_ids": [],
|
||||
"reviewer_ids": [],
|
||||
"labels": [],
|
||||
"state": "merged",
|
||||
"blocking_discussions_resolved": true,
|
||||
"first_contribution": false,
|
||||
"detailed_merge_status": "not_open",
|
||||
"action": "merge"
|
||||
},
|
||||
"labels": [],
|
||||
"changes": {
|
||||
"state_id": {
|
||||
"previous": 4,
|
||||
"current": 3
|
||||
},
|
||||
"updated_at": {
|
||||
"previous": "2023-12-05 18:43:00 UTC",
|
||||
"current": "2023-12-05 18:43:00 UTC"
|
||||
}
|
||||
},
|
||||
"repository": {
|
||||
"name": "woodpecker-test",
|
||||
"url": "git@gitlab.com:anbraten/woodpecker-test.git",
|
||||
"description": "",
|
||||
"homepage": "https://gitlab.com/anbraten/woodpecker-test"
|
||||
}
|
||||
}
|
||||
`)
|
||||
|
||||
Reference in New Issue
Block a user