Skip to content

Commit 71ecc3b

Browse files
added issue comment hook support for Azure (drone#200)
* added issue comment hook support for Azure * added supported actions
1 parent bff9695 commit 71ecc3b

9 files changed

+875
-0
lines changed

scm/const.go

+4
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ func (a Action) String() (s string) {
6767
return "synchronized"
6868
case ActionMerge:
6969
return "merged"
70+
case ActionEdit:
71+
return "edited"
7072
default:
7173
return
7274
}
@@ -104,6 +106,8 @@ func (a *Action) UnmarshalJSON(data []byte) error {
104106
*a = ActionSync
105107
case "merged":
106108
*a = ActionMerge
109+
case "edited":
110+
*a = ActionEdit
107111
}
108112
return nil
109113
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
{
2+
"subscriptionId": "00000000-0000-0000-0000-000000000000",
3+
"notificationId": 2,
4+
"id": "af07be1b-f3ad-44c8-a7f1-c4835f2df06b",
5+
"eventType": "ms.vss-code.git-pullrequest-comment-event",
6+
"publisherId": "tfs",
7+
"message": {
8+
"text": "Jamal Hartnett has edited a pull request comment",
9+
"html": "Jamal Hartnett has <a href=\"https://fabrikam.visualstudio.com/DefaultCollection/_git/Fabrikam/pullrequest/1?discussionId=5\">edited</a> a pull request comment",
10+
"markdown": "Jamal Hartnett has [edited](https://fabrikam.visualstudio.com/DefaultCollection/_git/Fabrikam/pullrequest/1?discussionId=5) a pull request comment"
11+
},
12+
"detailedMessage": {
13+
"text": "Jamal Hartnett has edited a pull request comment\r\nThis is my comment.\r\n",
14+
"html": "Jamal Hartnett has <a href=\"https://fabrikam.visualstudio.com/DefaultCollection/_git/Fabrikam/pullrequest/1?discussionId=5\">edited</a> a pull request comment<p>This is my comment.</p>",
15+
"markdown": "Jamal Hartnett has [edited](https://fabrikam.visualstudio.com/DefaultCollection/_git/Fabrikam/pullrequest/1?discussionId=5) a pull request comment\r\nThis is my comment.\r\n"
16+
},
17+
"resource": {
18+
"comment": {
19+
"id": 2,
20+
"parentCommentId": 1,
21+
"author": {
22+
"displayName": "Jamal Hartnett",
23+
"url": "https://fabrikam.vssps.visualstudio.com/_apis/Identities/54d125f7-69f7-4191-904f-c5b96b6261c8",
24+
"id": "54d125f7-69f7-4191-904f-c5b96b6261c8",
25+
"uniqueName": "[email protected]",
26+
"imageUrl": "https://fabrikam.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=54d125f7-69f7-4191-904f-c5b96b6261c8"
27+
},
28+
"content": "This is my comment.",
29+
"publishedDate": "2014-06-17T16:55:46.589889Z",
30+
"lastUpdatedDate": "2014-06-17T16:55:46.589889Z",
31+
"lastContentUpdatedDate": "2014-06-17T16:58:33.123889Z",
32+
"commentType": "text",
33+
"_links": {
34+
"self": {
35+
"href": "https://fabrikam.visualstudio.com/DefaultCollection/_apis/git/repositories/4bc14d40-c903-45e2-872e-0462c7748079/pullRequests/1/threads/5/comments/2"
36+
},
37+
"repository": {
38+
"href": "http://joscol2/DefaultCollection/ebed510c-62eb-474b-965f-fd151ebb82e4/_apis/git/repositories/4bc14d40-c903-45e2-872e-0462c7748079"
39+
},
40+
"threads": {
41+
"href": "https://fabrikam.visualstudio.com/DefaultCollection/_apis/git/repositories/4bc14d40-c903-45e2-872e-0462c7748079/pullRequests/1/threads/5"
42+
}
43+
}
44+
},
45+
"pullRequest": {
46+
"repository": {
47+
"id": "4bc14d40-c903-45e2-872e-0462c7748079",
48+
"name": "Fabrikam",
49+
"url": "https://fabrikam.visualstudio.com/DefaultCollection/_apis/git/repositories/4bc14d40-c903-45e2-872e-0462c7748079",
50+
"project": {
51+
"id": "6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c",
52+
"name": "Fabrikam",
53+
"url": "https://fabrikam.visualstudio.com/DefaultCollection/_apis/projects/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c",
54+
"state": "wellFormed",
55+
"visibility": "unchanged",
56+
"lastUpdateTime": "0001-01-01T00:00:00"
57+
},
58+
"sshUrl": "[email protected]:v3/fabrikam/DefaultCollection/Fabrikam",
59+
"webUrl": "https://dev.azure.com/fabrikam/DefaultCollection/_git/Fabrikam",
60+
"remoteUrl": "https://fabrikam.visualstudio.com/DefaultCollection/_git/Fabrikam"
61+
},
62+
"pullRequestId": 1,
63+
"status": "active",
64+
"createdBy": {
65+
"displayName": "Jamal Hartnett",
66+
"url": "https://fabrikam.vssps.visualstudio.com/_apis/Identities/54d125f7-69f7-4191-904f-c5b96b6261c8",
67+
"id": "54d125f7-69f7-4191-904f-c5b96b6261c8",
68+
"uniqueName": "[email protected]",
69+
"imageUrl": "https://fabrikam.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=54d125f7-69f7-4191-904f-c5b96b6261c8"
70+
},
71+
"creationDate": "2014-06-17T16:55:46.589889Z",
72+
"title": "my first pull request",
73+
"description": " - test2\r\n",
74+
"sourceRefName": "refs/heads/mytopic",
75+
"targetRefName": "refs/heads/master",
76+
"mergeStatus": "succeeded",
77+
"mergeId": "a10bb228-6ba6-4362-abd7-49ea21333dbd",
78+
"lastMergeSourceCommit": {
79+
"commitId": "53d54ac915144006c2c9e90d2c7d3880920db49c",
80+
"url": "https://fabrikam.visualstudio.com/DefaultCollection/_apis/git/repositories/4bc14d40-c903-45e2-872e-0462c7748079/commits/53d54ac915144006c2c9e90d2c7d3880920db49c"
81+
},
82+
"lastMergeTargetCommit": {
83+
"commitId": "a511f535b1ea495ee0c903badb68fbc83772c882",
84+
"url": "https://fabrikam.visualstudio.com/DefaultCollection/_apis/git/repositories/4bc14d40-c903-45e2-872e-0462c7748079/commits/a511f535b1ea495ee0c903badb68fbc83772c882"
85+
},
86+
"lastMergeCommit": {
87+
"commitId": "eef717f69257a6333f221566c1c987dc94cc0d72",
88+
"url": "https://fabrikam.visualstudio.com/DefaultCollection/_apis/git/repositories/4bc14d40-c903-45e2-872e-0462c7748079/commits/eef717f69257a6333f221566c1c987dc94cc0d72"
89+
},
90+
"reviewers": [
91+
{
92+
"reviewerUrl": null,
93+
"vote": 0,
94+
"displayName": "[Mobile]\\Mobile Team",
95+
"url": "https://fabrikam.vssps.visualstudio.com/_apis/Identities/2ea2d095-48f9-4cd6-9966-62f6f574096c",
96+
"id": "2ea2d095-48f9-4cd6-9966-62f6f574096c",
97+
"uniqueName": "vstfs:///Classification/TeamProject/f0811a3b-8c8a-4e43-a3bf-9a049b4835bd\\Mobile Team",
98+
"imageUrl": "https://fabrikam.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=2ea2d095-48f9-4cd6-9966-62f6f574096c",
99+
"isContainer": true
100+
}
101+
],
102+
"commits": [
103+
{
104+
"commitId": "53d54ac915144006c2c9e90d2c7d3880920db49c",
105+
"url": "https://fabrikam.visualstudio.com/DefaultCollection/_apis/git/repositories/4bc14d40-c903-45e2-872e-0462c7748079/commits/53d54ac915144006c2c9e90d2c7d3880920db49c"
106+
}
107+
],
108+
"url": "https://fabrikam.visualstudio.com/DefaultCollection/_apis/git/repositories/4bc14d40-c903-45e2-872e-0462c7748079/pullRequests/1",
109+
"_links": {
110+
"web": {
111+
"href": "https://fabrikam.visualstudio.com/DefaultCollection/_git/Fabrikam/pullrequest/1#view=discussion"
112+
},
113+
"statuses": {
114+
"href": "https://fabrikam.visualstudio.com/DefaultCollection/_apis/git/repositories/4bc14d40-c903-45e2-872e-0462c7748079/pullRequests/1/statuses"
115+
}
116+
}
117+
}
118+
},
119+
"resourceVersion": "2.0",
120+
"resourceContainers": {
121+
"collection": {
122+
"id": "c12d0eb8-e382-443b-9f9c-c52cba5014c2"
123+
},
124+
"account": {
125+
"id": "f844ec47-a9db-4511-8281-8b63f4eaf94e"
126+
},
127+
"project": {
128+
"id": "be9b3917-87e6-42a4-a549-2bc06a7a878f"
129+
}
130+
},
131+
"createdDate": "2022-06-21T13:03:20.480894Z"
132+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
"Action": "created",
3+
"Repo": {
4+
"ID": "4bc14d40-c903-45e2-872e-0462c7748079",
5+
"Namespace": "Fabrikam",
6+
"Name": "Fabrikam",
7+
"Perm": null,
8+
"Branch": "mytopic",
9+
"Archived": false,
10+
"Private": false,
11+
"Visibility": 0,
12+
"Clone": "https://dev.azure.com/fabrikam/DefaultCollection/_git/Fabrikam",
13+
"CloneSSH": "[email protected]:v3/fabrikam/DefaultCollection/Fabrikam",
14+
"Link": "https://dev.azure.com/fabrikam/DefaultCollection/_git/Fabrikam",
15+
"Created": "0001-01-01T00:00:00Z",
16+
"Updated": "0001-01-01T00:00:00Z"
17+
},
18+
"Issue": {
19+
"Number": 1,
20+
"Title": "my first pull request",
21+
"Body": " - test2\r\n",
22+
"Link": "https://fabrikam.visualstudio.com/DefaultCollection/_apis/git/repositories/4bc14d40-c903-45e2-872e-0462c7748079/pullRequests/1",
23+
"Author": {
24+
"Login": "Jamal Hartnett",
25+
"Name": "Jamal Hartnett",
26+
"Email": "[email protected]",
27+
"Avatar": "https://fabrikam.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=54d125f7-69f7-4191-904f-c5b96b6261c8",
28+
"Created": "0001-01-01T00:00:00Z",
29+
"Updated": "0001-01-01T00:00:00Z"
30+
},
31+
"PullRequest": {
32+
"Number": 1,
33+
"Title": "my first pull request",
34+
"Body": " - test2\r\n",
35+
"Sha": "53d54ac915144006c2c9e90d2c7d3880920db49c",
36+
"Ref": "refs/heads/mytopic",
37+
"Source": "mytopic",
38+
"Target": "master",
39+
"Fork": "",
40+
"Link": "https://fabrikam.visualstudio.com/DefaultCollection/_apis/git/repositories/4bc14d40-c903-45e2-872e-0462c7748079/pullRequests/1",
41+
"Diff": "",
42+
"Closed": false,
43+
"Merged": false,
44+
"Base": {
45+
"Name": "",
46+
"Path": "",
47+
"Sha": ""
48+
},
49+
"Head": {
50+
"Name": "",
51+
"Path": "",
52+
"Sha": ""
53+
},
54+
"Author": {
55+
"Login": "Jamal Hartnett",
56+
"Name": "Jamal Hartnett",
57+
"Email": "[email protected]",
58+
"Avatar": "https://fabrikam.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=54d125f7-69f7-4191-904f-c5b96b6261c8",
59+
"Created": "0001-01-01T00:00:00Z",
60+
"Updated": "0001-01-01T00:00:00Z"
61+
},
62+
"Created": "2014-06-17T16:55:46.589889Z",
63+
"Updated": "0001-01-01T00:00:00Z",
64+
"Labels": null
65+
},
66+
"Created": "2014-06-17T16:55:46.589889Z"
67+
},
68+
"Comment": {
69+
"ID": 2,
70+
"Body": "This is my comment.",
71+
"Author": {
72+
"Login": "54d125f7-69f7-4191-904f-c5b96b6261c8",
73+
"Name": "Jamal Hartnett",
74+
"Email": "[email protected]",
75+
"Created": "0001-01-01T00:00:00Z",
76+
"Updated": "0001-01-01T00:00:00Z"
77+
},
78+
"Created": "2014-06-17T16:55:46.589889Z",
79+
"Updated": "2014-06-17T16:55:46.589889Z"
80+
},
81+
"Sender": {
82+
"Login": "54d125f7-69f7-4191-904f-c5b96b6261c8",
83+
"Name": "Jamal Hartnett",
84+
"Email": "[email protected]",
85+
"Created": "0001-01-01T00:00:00Z",
86+
"Updated": "0001-01-01T00:00:00Z"
87+
}
88+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
{
2+
"subscriptionId": "00000000-0000-0000-0000-000000000000",
3+
"notificationId": 2,
4+
"id": "af07be1b-f3ad-44c8-a7f1-c4835f2df06b",
5+
"eventType": "ms.vss-code.git-pullrequest-comment-event",
6+
"publisherId": "tfs",
7+
"message": {
8+
"text": "Jamal Hartnett has edited a pull request comment",
9+
"html": "Jamal Hartnett has <a href=\"https://fabrikam.visualstudio.com/DefaultCollection/_git/Fabrikam/pullrequest/1?discussionId=5\">edited</a> a pull request comment",
10+
"markdown": "Jamal Hartnett has [edited](https://fabrikam.visualstudio.com/DefaultCollection/_git/Fabrikam/pullrequest/1?discussionId=5) a pull request comment"
11+
},
12+
"detailedMessage": {
13+
"text": "Jamal Hartnett has edited a pull request comment\r\nThis is my comment.\r\n",
14+
"html": "Jamal Hartnett has <a href=\"https://fabrikam.visualstudio.com/DefaultCollection/_git/Fabrikam/pullrequest/1?discussionId=5\">edited</a> a pull request comment<p>This is my comment.</p>",
15+
"markdown": "Jamal Hartnett has [edited](https://fabrikam.visualstudio.com/DefaultCollection/_git/Fabrikam/pullrequest/1?discussionId=5) a pull request comment\r\nThis is my comment.\r\n"
16+
},
17+
"resource": {
18+
"comment": {
19+
"id": 2,
20+
"parentCommentId": 1,
21+
"author": {
22+
"displayName": "Jamal Hartnett",
23+
"url": "https://fabrikam.vssps.visualstudio.com/_apis/Identities/54d125f7-69f7-4191-904f-c5b96b6261c8",
24+
"id": "54d125f7-69f7-4191-904f-c5b96b6261c8",
25+
"uniqueName": "[email protected]",
26+
"imageUrl": "https://fabrikam.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=54d125f7-69f7-4191-904f-c5b96b6261c8"
27+
},
28+
"content": "This is my comment.",
29+
"publishedDate": "2014-06-17T16:55:46.589889Z",
30+
"lastUpdatedDate": "2014-06-17T16:58:33.123889Z",
31+
"lastContentUpdatedDate": "2014-06-17T16:58:33.123889Z",
32+
"commentType": "text",
33+
"isDeleted": true,
34+
"_links": {
35+
"self": {
36+
"href": "https://fabrikam.visualstudio.com/DefaultCollection/_apis/git/repositories/4bc14d40-c903-45e2-872e-0462c7748079/pullRequests/1/threads/5/comments/2"
37+
},
38+
"repository": {
39+
"href": "http://joscol2/DefaultCollection/ebed510c-62eb-474b-965f-fd151ebb82e4/_apis/git/repositories/4bc14d40-c903-45e2-872e-0462c7748079"
40+
},
41+
"threads": {
42+
"href": "https://fabrikam.visualstudio.com/DefaultCollection/_apis/git/repositories/4bc14d40-c903-45e2-872e-0462c7748079/pullRequests/1/threads/5"
43+
}
44+
}
45+
},
46+
"pullRequest": {
47+
"repository": {
48+
"id": "4bc14d40-c903-45e2-872e-0462c7748079",
49+
"name": "Fabrikam",
50+
"url": "https://fabrikam.visualstudio.com/DefaultCollection/_apis/git/repositories/4bc14d40-c903-45e2-872e-0462c7748079",
51+
"project": {
52+
"id": "6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c",
53+
"name": "Fabrikam",
54+
"url": "https://fabrikam.visualstudio.com/DefaultCollection/_apis/projects/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c",
55+
"state": "wellFormed",
56+
"visibility": "unchanged",
57+
"lastUpdateTime": "0001-01-01T00:00:00"
58+
},
59+
"sshUrl": "[email protected]:v3/fabrikam/DefaultCollection/Fabrikam",
60+
"webUrl": "https://dev.azure.com/fabrikam/DefaultCollection/_git/Fabrikam",
61+
"remoteUrl": "https://fabrikam.visualstudio.com/DefaultCollection/_git/Fabrikam"
62+
},
63+
"pullRequestId": 1,
64+
"status": "active",
65+
"createdBy": {
66+
"displayName": "Jamal Hartnett",
67+
"url": "https://fabrikam.vssps.visualstudio.com/_apis/Identities/54d125f7-69f7-4191-904f-c5b96b6261c8",
68+
"id": "54d125f7-69f7-4191-904f-c5b96b6261c8",
69+
"uniqueName": "[email protected]",
70+
"imageUrl": "https://fabrikam.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=54d125f7-69f7-4191-904f-c5b96b6261c8"
71+
},
72+
"creationDate": "2014-06-17T16:55:46.589889Z",
73+
"title": "my first pull request",
74+
"description": " - test2\r\n",
75+
"sourceRefName": "refs/heads/mytopic",
76+
"targetRefName": "refs/heads/master",
77+
"mergeStatus": "succeeded",
78+
"mergeId": "a10bb228-6ba6-4362-abd7-49ea21333dbd",
79+
"lastMergeSourceCommit": {
80+
"commitId": "53d54ac915144006c2c9e90d2c7d3880920db49c",
81+
"url": "https://fabrikam.visualstudio.com/DefaultCollection/_apis/git/repositories/4bc14d40-c903-45e2-872e-0462c7748079/commits/53d54ac915144006c2c9e90d2c7d3880920db49c"
82+
},
83+
"lastMergeTargetCommit": {
84+
"commitId": "a511f535b1ea495ee0c903badb68fbc83772c882",
85+
"url": "https://fabrikam.visualstudio.com/DefaultCollection/_apis/git/repositories/4bc14d40-c903-45e2-872e-0462c7748079/commits/a511f535b1ea495ee0c903badb68fbc83772c882"
86+
},
87+
"lastMergeCommit": {
88+
"commitId": "eef717f69257a6333f221566c1c987dc94cc0d72",
89+
"url": "https://fabrikam.visualstudio.com/DefaultCollection/_apis/git/repositories/4bc14d40-c903-45e2-872e-0462c7748079/commits/eef717f69257a6333f221566c1c987dc94cc0d72"
90+
},
91+
"reviewers": [
92+
{
93+
"reviewerUrl": null,
94+
"vote": 0,
95+
"displayName": "[Mobile]\\Mobile Team",
96+
"url": "https://fabrikam.vssps.visualstudio.com/_apis/Identities/2ea2d095-48f9-4cd6-9966-62f6f574096c",
97+
"id": "2ea2d095-48f9-4cd6-9966-62f6f574096c",
98+
"uniqueName": "vstfs:///Classification/TeamProject/f0811a3b-8c8a-4e43-a3bf-9a049b4835bd\\Mobile Team",
99+
"imageUrl": "https://fabrikam.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=2ea2d095-48f9-4cd6-9966-62f6f574096c",
100+
"isContainer": true
101+
}
102+
],
103+
"commits": [
104+
{
105+
"commitId": "53d54ac915144006c2c9e90d2c7d3880920db49c",
106+
"url": "https://fabrikam.visualstudio.com/DefaultCollection/_apis/git/repositories/4bc14d40-c903-45e2-872e-0462c7748079/commits/53d54ac915144006c2c9e90d2c7d3880920db49c"
107+
}
108+
],
109+
"url": "https://fabrikam.visualstudio.com/DefaultCollection/_apis/git/repositories/4bc14d40-c903-45e2-872e-0462c7748079/pullRequests/1",
110+
"_links": {
111+
"web": {
112+
"href": "https://fabrikam.visualstudio.com/DefaultCollection/_git/Fabrikam/pullrequest/1#view=discussion"
113+
},
114+
"statuses": {
115+
"href": "https://fabrikam.visualstudio.com/DefaultCollection/_apis/git/repositories/4bc14d40-c903-45e2-872e-0462c7748079/pullRequests/1/statuses"
116+
}
117+
}
118+
}
119+
},
120+
"resourceVersion": "2.0",
121+
"resourceContainers": {
122+
"collection": {
123+
"id": "c12d0eb8-e382-443b-9f9c-c52cba5014c2"
124+
},
125+
"account": {
126+
"id": "f844ec47-a9db-4511-8281-8b63f4eaf94e"
127+
},
128+
"project": {
129+
"id": "be9b3917-87e6-42a4-a549-2bc06a7a878f"
130+
}
131+
},
132+
"createdDate": "2022-06-21T13:03:20.480894Z"
133+
}

0 commit comments

Comments
 (0)