From b0386ddc321f3d5ceec6862b2d252f9360619889 Mon Sep 17 00:00:00 2001 From: Victor Vrantchan Date: Wed, 12 Oct 2016 15:23:37 -0400 Subject: [PATCH] Use nested commit for StatusEvent Full documentation of StatusEvent webhook here: https://developer.github.com/v3/activity/events/types/#statusevent Use RepositoryCommit type for Commit field in StatusEvent. Fixes #448. Closes #449. Change-Id: I9a2936a1893f50c3b507f6f295428db85ecf932b --- github/event_types.go | 16 ++++++++-------- github/repos_commits.go | 16 +++++++++------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/github/event_types.go b/github/event_types.go index 97472ce..16f89b0 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -451,14 +451,14 @@ type StatusEvent struct { Branches []*Branch `json:"branches,omitempty"` // The following fields are only populated by Webhook events. - ID *int `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Context *string `json:"context,omitempty"` - Commit *PushEventCommit `json:"commit,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - Repo *Repository `json:"repository,omitempty"` - Sender *User `json:"sender,omitempty"` + ID *int `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Context *string `json:"context,omitempty"` + Commit *RepositoryCommit `json:"commit,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + Repo *Repository `json:"repository,omitempty"` + Sender *User `json:"sender,omitempty"` } // TeamAddEvent is triggered when a repository is added to a team. diff --git a/github/repos_commits.go b/github/repos_commits.go index b5e6856..c1359f4 100644 --- a/github/repos_commits.go +++ b/github/repos_commits.go @@ -15,13 +15,15 @@ import ( // Note that it's wrapping a Commit, so author/committer information is in two places, // but contain different details about them: in RepositoryCommit "github details", in Commit - "git details". type RepositoryCommit struct { - SHA *string `json:"sha,omitempty"` - Commit *Commit `json:"commit,omitempty"` - Author *User `json:"author,omitempty"` - Committer *User `json:"committer,omitempty"` - Parents []Commit `json:"parents,omitempty"` - Message *string `json:"message,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` + SHA *string `json:"sha,omitempty"` + Commit *Commit `json:"commit,omitempty"` + Author *User `json:"author,omitempty"` + Committer *User `json:"committer,omitempty"` + Parents []Commit `json:"parents,omitempty"` + Message *string `json:"message,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + URL *string `json:"url,omitempty"` + CommentsURL *string `json:"comments_url,omitempty"` // Details about how many changes were made in this commit. Only filled in during GetCommit! Stats *CommitStats `json:"stats,omitempty"`