Skip to content

Commit 93042b7

Browse files
feat: add pr link as coming from new webhook (#290)
1 parent 2877ffa commit 93042b7

13 files changed

+20
-13
lines changed

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"type": "user",
3535
"created": 1675390885380,
3636
"updated": 1675390885380
37-
}
37+
},
38+
"pr_url": "http://localhost:3000/codeowners/asdsad/pulls/14"
3839
},
3940
"target_ref": {
4041
"name": "refs/heads/main",

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"Source": "b",
2222
"Target": "main",
2323
"Fork": "fork",
24-
"Link": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/myOrg/myProject/aba.git",
24+
"Link": "http://localhost:3000/codeowners/asdsad/pulls/14",
2525
"Closed": false,
2626
"Merged": false,
2727
"Author": {

scm/driver/harness/testdata/webhooks/pull_request_closed.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
"type": "user",
3434
"created": 1696332021613,
3535
"updated": 1696332021613
36-
}
36+
},
37+
"pr_url": "http://localhost:3000/codeowners/asdsad/pulls/14"
3738
},
3839
"target_ref": {
3940
"name": "refs/heads/main",

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"Source": "asdxsa",
2222
"Target": "main",
2323
"Fork": "fork",
24-
"Link": "http://localhost:3000/git/codeowners/asdsad.git",
24+
"Link": "http://localhost:3000/codeowners/asdsad/pulls/14",
2525
"Closed": true,
2626
"Merged": false,
2727
"Author": {

scm/driver/harness/testdata/webhooks/pull_request_comment_created.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"type": "user",
3535
"created": 1675390885380,
3636
"updated": 1675390885380
37-
}
37+
},
38+
"pr_url": "http://localhost:3000/codeowners/asdsad/pulls/14"
3839
},
3940
"target_ref": {
4041
"name": "refs/heads/main",

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"Source": "pr2",
2121
"Target": "main",
2222
"Fork": "fork",
23-
"Link": "http://localhost:3000/git/asd/demo.git",
23+
"Link": "http://localhost:3000/codeowners/asdsad/pulls/14",
2424
"Closed": false,
2525
"Merged": false,
2626
"Author": {

scm/driver/harness/testdata/webhooks/pull_request_merged.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"type": "user",
3535
"created": 1696332021613,
3636
"updated": 1696332021613
37-
}
37+
},
38+
"pr_url": "http://localhost:3000/codeowners/asdsad/pulls/14"
3839
},
3940
"target_ref": {
4041
"name": "refs/heads/main",

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"Source": "xas",
2222
"Target": "main",
2323
"Fork": "fork",
24-
"Link": "http://localhost:3000/git/codeowners/asdsad.git",
24+
"Link": "http://localhost:3000/codeowners/asdsad/pulls/14",
2525
"Closed": true,
2626
"Merged": true,
2727
"Author": {

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"type": "user",
3535
"created": 1675390885380,
3636
"updated": 1675390885380
37-
}
37+
},
38+
"pr_url": "http://localhost:3000/codeowners/asdsad/pulls/14"
3839
},
3940
"target_ref": {
4041
"name": "refs/heads/main",

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"Source": "b",
2222
"Target": "main",
2323
"Fork": "fork",
24-
"Link": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/myOrg/myProject/aba.git",
24+
"Link": "http://localhost:3000/codeowners/asdsad/pulls/14",
2525
"Closed": false,
2626
"Merged": false,
2727
"Author": {

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"type": "user",
3535
"created": 1675390885380,
3636
"updated": 1675390885380
37-
}
37+
},
38+
"pr_url": "http://localhost:3000/codeowners/asdsad/pulls/14"
3839
},
3940
"target_ref": {
4041
"name": "refs/heads/main",

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"Source": "b",
2222
"Target": "main",
2323
"Fork": "fork",
24-
"Link": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/myOrg/myProject/aba.git",
24+
"Link": "http://localhost:3000/codeowners/asdsad/pulls/14",
2525
"Closed": false,
2626
"Merged": false,
2727
"Author": {

scm/driver/harness/webhook.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ type (
128128
TargetBranch string `json:"target_branch"`
129129
MergeStrategy interface{} `json:"merge_strategy"`
130130
Author principal `json:"author"`
131+
PrURL string `json:"pr_url"`
131132
}
132133
targetRef struct {
133134
Name string `json:"name"`
@@ -277,7 +278,7 @@ func convertPullReq(pr pullReq, ref ref, commit hookCommit) scm.PullRequest {
277278
Target: pr.TargetBranch,
278279
Merged: pr.State == "merged",
279280
Fork: "fork",
280-
Link: ref.Repo.GitURL,
281+
Link: pr.PrURL,
281282
Sha: commit.Sha,
282283
Ref: ref.Name,
283284
Author: convertUser(pr.Author),

0 commit comments

Comments
 (0)