mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-18 15:27:16 +02:00
fix highwayhash
This commit is contained in:
committed by
Cole Wippern
parent
5a2cfeabba
commit
6b020a1f97
+9
-37
@@ -69,55 +69,27 @@ func (w WebHookAuthor) String() string {
|
||||
|
||||
// Hook represents a GitHub (web and service) hook for a repository.
|
||||
type Hook struct {
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
|
||||
// Only the following fields are used when creating a hook.
|
||||
// Name and Config are required.
|
||||
Name *string `json:"name,omitempty"`
|
||||
Config map[string]interface{} `json:"config,omitempty"`
|
||||
Events []string `json:"events,omitempty"`
|
||||
Active *bool `json:"active,omitempty"`
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
Events []string `json:"events,omitempty"`
|
||||
Active *bool `json:"active,omitempty"`
|
||||
Config map[string]interface{} `json:"config,omitempty"`
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
}
|
||||
|
||||
func (h Hook) String() string {
|
||||
return Stringify(h)
|
||||
}
|
||||
|
||||
// createHookRequest is a subset of Hook and is used internally
|
||||
// by CreateHook to pass only the known fields for the endpoint.
|
||||
//
|
||||
// See https://github.com/google/go-github/issues/1015 for more
|
||||
// information.
|
||||
type createHookRequest struct {
|
||||
// Name and Config are required.
|
||||
// Name must be passed as "web".
|
||||
Name *string `json:"name,omitempty"`
|
||||
Config map[string]interface{} `json:"config,omitempty"`
|
||||
Events []string `json:"events,omitempty"`
|
||||
Active *bool `json:"active,omitempty"`
|
||||
}
|
||||
|
||||
// CreateHook creates a Hook for the specified repository.
|
||||
// Name and Config are required fields.
|
||||
//
|
||||
// Note that only a subset of the hook fields are used and hook must
|
||||
// not be nil.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#create-a-hook
|
||||
func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string, hook *Hook) (*Hook, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo)
|
||||
|
||||
hookReq := &createHookRequest{
|
||||
Name: hook.Name,
|
||||
Events: hook.Events,
|
||||
Active: hook.Active,
|
||||
Config: hook.Config,
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, hookReq)
|
||||
req, err := s.client.NewRequest("POST", u, hook)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user