Browse Source

go-github: add useful fields to Webhooks

Change-Id: Ia4888efa18c557a31af7093cfa449a67650afa20
Glenn Lewis 10 years ago
parent
commit
5f4a113632
3 changed files with 19 additions and 9 deletions
  1. +13
    -8
      github/event_types.go
  2. +3
    -0
      github/git_commits.go
  3. +3
    -1
      github/repos_deployments.go

+ 13
- 8
github/event_types.go View File

@ -301,14 +301,15 @@ 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"`
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"`
SHA *string `json:"sha,omitempty"`
Message *string `json:"message,omitempty"`
Author *CommitAuthor `json:"author,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"`
}
func (p PushEventCommit) String() string {
@ -341,6 +342,10 @@ type PushEventRepository struct {
DefaultBranch *string `json:"default_branch,omitempty"`
MasterBranch *string `json:"master_branch,omitempty"`
Organization *string `json:"organization,omitempty"`
// The following fields are only populated by Webhook events.
URL *string `json:"url,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
}
// PushEventRepoOwner is a basic reporesntation of user/org in a PushEvent payload


+ 3
- 0
github/git_commits.go View File

@ -37,6 +37,9 @@ type CommitAuthor struct {
Date *time.Time `json:"date,omitempty"`
Name *string `json:"name,omitempty"`
Email *string `json:"email,omitempty"`
// The following fields are only populated by Webhook events.
Login *string `json:"username,omitempty"` // Renamed for go-github consistency.
}
func (c CommitAuthor) String() string {


+ 3
- 1
github/repos_deployments.go View File

@ -103,7 +103,9 @@ func (s *RepositoriesService) CreateDeployment(owner, repo string, request *Depl
// DeploymentStatus represents the status of a
// particular deployment.
type DeploymentStatus struct {
ID *int `json:"id,omitempty"`
ID *int `json:"id,omitempty"`
// State is the deployment state.
// Possible values are: "pending", "success", "failure", "error".
State *string `json:"state,omitempty"`
Creator *User `json:"creator,omitempty"`
Description *string `json:"description,omitempty"`


Loading…
Cancel
Save