Skip to content

Commit 6982ab8

Browse files
feat: add more parsed data in harness webhook parsing (#279)
1 parent 166ac92 commit 6982ab8

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

scm/driver/harness/testdata/webhooks/pull_request_branch_updated.json.golden

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Name": "",
77
"Branch": "main",
88
"Private": false,
9-
"Clone": "",
9+
"Clone": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/myOrg/myProject/aba.git",
1010
"CloneSSH": "",
1111
"Link": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/myOrg/myProject/aba.git",
1212
"Created": "0001-01-01T00:00:00Z",
@@ -17,7 +17,7 @@
1717
"Title": "aw",
1818
"Body": "",
1919
"Sha": "f74f3d2a88d1b7cb19ff3bf069aa423763d341ef",
20-
"Ref": "",
20+
"Ref": "refs/heads/b",
2121
"Source": "b",
2222
"Target": "main",
2323
"Fork": "fork",
@@ -26,8 +26,8 @@
2626
"Merged": false,
2727
"Author": {
2828
"Login": "",
29-
"Name": "",
30-
"Email": "",
29+
"Name": "Admin",
30+
"Email": "[email protected]",
3131
"Avatar": ""
3232
},
3333
"Created": "0001-01-01T00:00:00Z",

scm/driver/harness/testdata/webhooks/pull_request_opened.json.golden

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Name": "",
77
"Branch": "main",
88
"Private": false,
9-
"Clone": "",
9+
"Clone": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/myOrg/myProject/aba.git",
1010
"CloneSSH": "",
1111
"Link": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/myOrg/myProject/aba.git",
1212
"Created": "0001-01-01T00:00:00Z",
@@ -17,7 +17,7 @@
1717
"Title": "aw",
1818
"Body": "",
1919
"Sha": "d74b1ebfe520ac01b209dd9085f005884cc9f4cd",
20-
"Ref": "",
20+
"Ref": "refs/heads/b",
2121
"Source": "b",
2222
"Target": "main",
2323
"Fork": "fork",
@@ -26,8 +26,8 @@
2626
"Merged": false,
2727
"Author": {
2828
"Login": "",
29-
"Name": "",
30-
"Email": "",
29+
"Name": "Admin",
30+
"Email": "[email protected]",
3131
"Avatar": ""
3232
},
3333
"Created": "0001-01-01T00:00:00Z",

scm/driver/harness/testdata/webhooks/pull_request_reopened.json.golden

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Name": "",
77
"Branch": "main",
88
"Private": false,
9-
"Clone": "",
9+
"Clone": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/myOrg/myProject/aba.git",
1010
"CloneSSH": "",
1111
"Link": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/myOrg/myProject/aba.git",
1212
"Created": "0001-01-01T00:00:00Z",
@@ -17,7 +17,7 @@
1717
"Title": "aw",
1818
"Body": "",
1919
"Sha": "f74f3d2a88d1b7cb19ff3bf069aa423763d341ef",
20-
"Ref": "",
20+
"Ref": "refs/heads/b",
2121
"Source": "b",
2222
"Target": "main",
2323
"Fork": "fork",
@@ -26,8 +26,8 @@
2626
"Merged": false,
2727
"Author": {
2828
"Login": "",
29-
"Name": "",
30-
"Email": "",
29+
"Name": "Admin",
30+
"Email": "[email protected]",
3131
"Avatar": ""
3232
},
3333
"Created": "0001-01-01T00:00:00Z",

scm/driver/harness/webhook.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,17 @@ func convertPullRequestHook(dst *pullRequestHook) *scm.PullRequestHook {
196196
Fork: "fork",
197197
Link: dst.Ref.Repo.GitURL,
198198
Sha: dst.Commit.Sha,
199+
Ref: dst.Ref.Name,
200+
Author: scm.User{
201+
Name: dst.Commit.Committer.Identity.Name,
202+
Email: dst.Commit.Committer.Identity.Email,
203+
},
199204
},
200205
Repo: scm.Repository{
201206
ID: dst.Repo.UID,
202207
Branch: dst.Repo.DefaultBranch,
203208
Link: dst.Repo.GitURL,
209+
Clone: dst.Repo.GitURL,
204210
},
205211
Sender: scm.User{
206212
Email: dst.Principal.Email,

0 commit comments

Comments
 (0)