diff --git a/scm/driver/azure/webhook.go b/scm/driver/azure/webhook.go index 73a0a8d37..d2e6f0daa 100644 --- a/scm/driver/azure/webhook.go +++ b/scm/driver/azure/webhook.go @@ -300,7 +300,7 @@ func convertIssueCommentHook(src *issueCommentPullRequestHook) *scm.IssueComment Email: src.Resource.PullRequest.CreatedBy.UniqueName, Avatar: src.Resource.PullRequest.CreatedBy.ImageURL, }, - PullRequest: scm.PullRequest{ + PullRequest: &scm.PullRequest{ Number: src.Resource.PullRequest.PullRequestID, Title: src.Resource.PullRequest.Title, Body: src.Resource.PullRequest.Description, diff --git a/scm/driver/github/issue.go b/scm/driver/github/issue.go index 996e98cf5..109d5e061 100644 --- a/scm/driver/github/issue.go +++ b/scm/driver/github/issue.go @@ -364,7 +364,7 @@ func convertIssue(from *issue) *scm.Issue { }, ClosedBy: closedBy, Assignees: convertUsers(from.Assignees), - PullRequest: scm.PullRequest{ + PullRequest: &scm.PullRequest{ DiffLink: from.PullRequest.DiffURL, Link: from.PullRequest.HTMLURL, }, diff --git a/scm/driver/github/issue_test.go b/scm/driver/github/issue_test.go index 2b61cb555..79b6d841a 100644 --- a/scm/driver/github/issue_test.go +++ b/scm/driver/github/issue_test.go @@ -149,9 +149,10 @@ func TestIssueSearch(t *testing.T) { t.Error(err) } - data, _ := json.Marshal(got) - t.Log(string(data)) - + _, err = json.Marshal(got) + if err != nil { + t.Error(err) + } if diff := cmp.Diff(got, want); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) diff --git a/scm/driver/github/testdata/issue_search.json.golden b/scm/driver/github/testdata/issue_search.json.golden index 69f0a2ea0..33243f168 100644 --- a/scm/driver/github/testdata/issue_search.json.golden +++ b/scm/driver/github/testdata/issue_search.json.golden @@ -35,6 +35,11 @@ "Link": "", "Created": "0001-01-01T00:00:00Z", "Updated": "0001-01-01T00:00:00Z" + }, + "PullRequest": { + "html_url": null, + "diff_url": null, + "patch_url": null } } -] \ No newline at end of file +] diff --git a/scm/driver/github/testdata/webhooks/issue_comment.json.golden b/scm/driver/github/testdata/webhooks/issue_comment.json.golden index 47c28045c..085f87cb2 100644 --- a/scm/driver/github/testdata/webhooks/issue_comment.json.golden +++ b/scm/driver/github/testdata/webhooks/issue_comment.json.golden @@ -27,6 +27,11 @@ "Labels": [ "bug" ], + "PullRequest": { + "html_url": null, + "diff_url": null, + "patch_url": null + }, "Closed": false, "Locked": false, "Author": { diff --git a/scm/driver/github/webhook_test.go b/scm/driver/github/webhook_test.go index d08a647e5..cd28ba28d 100644 --- a/scm/driver/github/webhook_test.go +++ b/scm/driver/github/webhook_test.go @@ -296,7 +296,7 @@ func TestWebhooks(t *testing.T) { }, // deployment { - name: "deployemnt", + name: "deployment", event: "deployment", before: "testdata/webhooks/deployment.json", after: "testdata/webhooks/deployment.json.golden", diff --git a/scm/issue.go b/scm/issue.go index 10c39faf9..4baa1f49b 100644 --- a/scm/issue.go +++ b/scm/issue.go @@ -24,7 +24,7 @@ type ( Author User Assignees []User ClosedBy *User - PullRequest PullRequest + PullRequest *PullRequest Created time.Time Updated time.Time } diff --git a/scm/webhook.go b/scm/webhook.go index b11faa667..ec8bab6f0 100644 --- a/scm/webhook.go +++ b/scm/webhook.go @@ -18,7 +18,7 @@ var ( // ErrUnknownEvent is returned when the webhook event // is not recognized by the system. - ErrUnknownEvent = errors.New("Unknown webhook event") + ErrUnknownEvent = errors.New("unknown webhook event") ) // WebhookKind is the kind of webhook event represented