Skip to content

Commit

Permalink
Add PRs to WorkflowRunPayload fixed go-playground#140
Browse files Browse the repository at this point in the history
  • Loading branch information
craftyc0der committed Feb 3, 2022
1 parent 9c954e2 commit 28a3103
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
2 changes: 1 addition & 1 deletion github/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
},
}
Expand Down
25 changes: 24 additions & 1 deletion github/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
25 changes: 25 additions & 0 deletions testdata/github/workflow_run.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 28a3103

Please sign in to comment.