From bdd0f40310218ad0a768452dbcfef9482a182e8f Mon Sep 17 00:00:00 2001 From: Glenn Lewis Date: Tue, 21 Jun 2016 09:26:27 -0700 Subject: [PATCH] better support both Events API and Webhook events in PushEventCommit Fixes #370. Change-Id: I0a8567ae352bd2e9e973ac73383894d2b4cdfb9d --- github/event_types.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/github/event_types.go b/github/event_types.go index 6f7202e..f3e163d 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -316,12 +316,19 @@ func (p PushEvent) String() string { // PushEventCommit represents a git commit in a GitHub PushEvent. type PushEventCommit struct { - SHA *string `json:"sha,omitempty"` - Message *string `json:"message,omitempty"` - Author *CommitAuthor `json:"author,omitempty"` + Message *string `json:"message,omitempty"` + Author *CommitAuthor `json:"author,omitempty"` + URL *string `json:"url,omitempty"` + Distinct *bool `json:"distinct,omitempty"` + + // The following fields are only populated by Events API. + SHA *string `json:"sha,omitempty"` + + // The following fields are only populated by Webhook events. + ID *string `json:"id,omitempty"` + TreeID *string `json:"tree_id,omitempty"` + Timestamp *Timestamp `json:"timestamp,omitempty"` Committer *CommitAuthor `json:"committer,omitempty"` - URL *string `json:"url,omitempty"` - Distinct *bool `json:"distinct,omitempty"` Added []string `json:"added,omitempty"` Removed []string `json:"removed,omitempty"` Modified []string `json:"modified,omitempty"`