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

Commit dfe64e4

Browse files
committed
Move installation event into SDK
Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
1 parent e53d306 commit dfe64e4

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

sdk/events_scm.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,20 @@ type Customer struct {
5959
type Sender struct {
6060
Login string `json:"login"`
6161
}
62+
63+
type InstallationRepositoriesEvent struct {
64+
Action string `json:"action"`
65+
Installation struct {
66+
Account struct {
67+
Login string
68+
}
69+
} `json:"installation"`
70+
RepositoriesRemoved []Installation `json:"repositories_removed"`
71+
RepositoriesAdded []Installation `json:"repositories_added"`
72+
Repositories []Installation `json:"repositories"`
73+
}
74+
75+
type Installation struct {
76+
Name string `json:"name"`
77+
FullName string `json:"full_name"`
78+
}

sdk/service.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,11 @@ func CreateServiceURL(URL, suffix string) string {
2222
}
2323
return fmt.Sprintf("%s.%s", URL, suffix)
2424
}
25+
26+
// FormatShortSHA returns a 7-digit SHA
27+
func FormatShortSHA(sha string) string {
28+
if len(sha) <= 7 {
29+
return sha
30+
}
31+
return sha[:7]
32+
}

0 commit comments

Comments
 (0)