Skip to content
This repository has been archived by the owner on Mar 10, 2023. It is now read-only.

Commit

Permalink
Move installation event into SDK
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Ellis (VMware) <[email protected]>
  • Loading branch information
alexellis committed Oct 29, 2018
1 parent e53d306 commit dfe64e4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
17 changes: 17 additions & 0 deletions sdk/events_scm.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,20 @@ type Customer struct {
type Sender struct {
Login string `json:"login"`
}

type InstallationRepositoriesEvent struct {
Action string `json:"action"`
Installation struct {
Account struct {
Login string
}
} `json:"installation"`
RepositoriesRemoved []Installation `json:"repositories_removed"`
RepositoriesAdded []Installation `json:"repositories_added"`
Repositories []Installation `json:"repositories"`
}

type Installation struct {
Name string `json:"name"`
FullName string `json:"full_name"`
}
8 changes: 8 additions & 0 deletions sdk/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,11 @@ func CreateServiceURL(URL, suffix string) string {
}
return fmt.Sprintf("%s.%s", URL, suffix)
}

// FormatShortSHA returns a 7-digit SHA
func FormatShortSHA(sha string) string {
if len(sha) <= 7 {
return sha
}
return sha[:7]
}

0 comments on commit dfe64e4

Please sign in to comment.