Skip to content

Commit 28a3103

Browse files
committed
Add PRs to WorkflowRunPayload fixed go-playground#140
1 parent 9c954e2 commit 28a3103

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed

github/github_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ func TestWebhooks(t *testing.T) {
570570
filename: "../testdata/github/workflow_run.json",
571571
headers: http.Header{
572572
"X-Github-Event": []string{"workflow_run"},
573-
"X-Hub-Signature": []string{"sha1=c54d046b1ce440bc3434c8de5ad73e0a630d7cbe"},
573+
"X-Hub-Signature": []string{"sha1=46c14317c062992de64d11e12a0bad91dd9c4f50"},
574574
},
575575
},
576576
}

github/payload.go

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6430,7 +6430,30 @@ type WorkflowRunPayload struct {
64306430
CheckSuiteNodeID string `json:"check_suite_node_id"`
64316431
URL string `json:"url"`
64326432
HTMLURL string `json:"html_url"`
6433-
// PullRequests []interface{} `json:"pull_requests"`
6433+
PullRequests []struct {
6434+
ID int64 `json:"id"`
6435+
Number int64 `json:"number"`
6436+
URL string `json:"url"`
6437+
Head struct {
6438+
Ref string `json:"ref"`
6439+
Sha string `json:"sha"`
6440+
URL string `json:"url"`
6441+
Repo struct {
6442+
ID int64 `json:"id"`
6443+
Name string `json:"name"`
6444+
URL string `json:"url"`
6445+
} `json:"repo"`
6446+
} `json:"head"`
6447+
Base struct {
6448+
Ref string `json:"ref"`
6449+
Sha string `json:"sha"`
6450+
Repo struct {
6451+
ID int64 `json:"id"`
6452+
Name string `json:"name"`
6453+
URL string `json:"url"`
6454+
} `json:"repo"`
6455+
} `json:"base"`
6456+
} `json:"pull_requests"`
64346457
CreatedAt time.Time `json:"created_at"`
64356458
UpdatedAt time.Time `json:"updated_at"`
64366459
RunAttempt int64 `json:"run_attempt"`

testdata/github/workflow_run.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,31 @@
1515
"check_suite_node_id": "1",
1616
"url": "https://api.github.com/users/baxterthehacker/",
1717
"html_url": "https://api.github.com/users/baxterthehacker/html_url",
18+
"pull_requests": [
19+
{
20+
"url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/43",
21+
"id": 836659880,
22+
"number": 43,
23+
"head": {
24+
"ref": "HeadBranch",
25+
"sha": "d6b80f8411bdc1a44407ff20619a74068b03ea5a",
26+
"repo": {
27+
"id": 434328729,
28+
"url": "https://api.github.com/repos/baxterthehacker/public-repo",
29+
"name": "public-repo"
30+
}
31+
},
32+
"base": {
33+
"ref": "master",
34+
"sha": "959ab634fb1411f204b2be49b68236808d6b741c",
35+
"repo": {
36+
"id": 434328729,
37+
"url": "https://api.github.com/repos/baxterthehacker/public-repo",
38+
"name": "public-repo"
39+
}
40+
}
41+
}
42+
],
1843
"created_at": "2015-05-05T23:40:12Z",
1944
"updated_at": "2015-05-05T23:40:30Z",
2045
"run_attempt": 1,

0 commit comments

Comments
 (0)