diff --git a/github/github_test.go b/github/github_test.go index 478efae..a37cf69 100644 --- a/github/github_test.go +++ b/github/github_test.go @@ -570,7 +570,7 @@ func TestWebhooks(t *testing.T) { filename: "../testdata/github/workflow_run.json", headers: http.Header{ "X-Github-Event": []string{"workflow_run"}, - "X-Hub-Signature": []string{"sha1=c54d046b1ce440bc3434c8de5ad73e0a630d7cbe"}, + "X-Hub-Signature": []string{"sha1=46c14317c062992de64d11e12a0bad91dd9c4f50"}, }, }, } diff --git a/github/payload.go b/github/payload.go index 0f46acc..36f25ef 100644 --- a/github/payload.go +++ b/github/payload.go @@ -6430,7 +6430,30 @@ type WorkflowRunPayload struct { CheckSuiteNodeID string `json:"check_suite_node_id"` URL string `json:"url"` HTMLURL string `json:"html_url"` - // PullRequests []interface{} `json:"pull_requests"` + PullRequests []struct { + ID int64 `json:"id"` + Number int64 `json:"number"` + URL string `json:"url"` + Head struct { + Ref string `json:"ref"` + Sha string `json:"sha"` + URL string `json:"url"` + Repo struct { + ID int64 `json:"id"` + Name string `json:"name"` + URL string `json:"url"` + } `json:"repo"` + } `json:"head"` + Base struct { + Ref string `json:"ref"` + Sha string `json:"sha"` + Repo struct { + ID int64 `json:"id"` + Name string `json:"name"` + URL string `json:"url"` + } `json:"repo"` + } `json:"base"` + } `json:"pull_requests"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` RunAttempt int64 `json:"run_attempt"` diff --git a/testdata/github/workflow_run.json b/testdata/github/workflow_run.json index ff3b090..e465c88 100644 --- a/testdata/github/workflow_run.json +++ b/testdata/github/workflow_run.json @@ -15,6 +15,31 @@ "check_suite_node_id": "1", "url": "https://api.github.com/users/baxterthehacker/", "html_url": "https://api.github.com/users/baxterthehacker/html_url", + "pull_requests": [ + { + "url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/43", + "id": 836659880, + "number": 43, + "head": { + "ref": "HeadBranch", + "sha": "d6b80f8411bdc1a44407ff20619a74068b03ea5a", + "repo": { + "id": 434328729, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "name": "public-repo" + } + }, + "base": { + "ref": "master", + "sha": "959ab634fb1411f204b2be49b68236808d6b741c", + "repo": { + "id": 434328729, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "name": "public-repo" + } + } + } + ], "created_at": "2015-05-05T23:40:12Z", "updated_at": "2015-05-05T23:40:30Z", "run_attempt": 1,