Skip to content

Commit e1f5ba4

Browse files
author
Dean Karn
authored
Merge pull request #88 from luca-moser/github-meta-event
Adds GitHub meta event/payload
2 parents 115b7e4 + ef903a2 commit e1f5ba4

File tree

2 files changed

+136
-0
lines changed

2 files changed

+136
-0
lines changed

github/github.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const (
4747
MemberEvent Event = "member"
4848
MembershipEvent Event = "membership"
4949
MilestoneEvent Event = "milestone"
50+
MetaEvent Event = "meta"
5051
OrganizationEvent Event = "organization"
5152
OrgBlockEvent Event = "org_block"
5253
PageBuildEvent Event = "page_build"
@@ -231,6 +232,10 @@ func (hook Webhook) Parse(r *http.Request, events ...Event) (interface{}, error)
231232
var pl MembershipPayload
232233
err = json.Unmarshal([]byte(payload), &pl)
233234
return pl, err
235+
case MetaEvent:
236+
var pl MetaPayload
237+
err = json.Unmarshal([]byte(payload), &pl)
238+
return pl, err
234239
case MilestoneEvent:
235240
var pl MilestonePayload
236241
err = json.Unmarshal([]byte(payload), &pl)

github/payload.go

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,6 +2271,137 @@ type MembershipPayload struct {
22712271
} `json:"organization"`
22722272
}
22732273

2274+
// MetaPayload contains the information for GitHub's meta hook event
2275+
type MetaPayload struct {
2276+
HookID int `json:"hook_id"`
2277+
Hook struct {
2278+
Type string `json:"type"`
2279+
ID int64 `json:"id"`
2280+
NodeID string `json:"node_id"`
2281+
Name string `json:"name"`
2282+
Active bool `json:"active"`
2283+
Events []string `json:"events"`
2284+
AppID int `json:"app_id"`
2285+
Config struct {
2286+
ContentType string `json:"content_type"`
2287+
InsecureSSL string `json:"insecure_ssl"`
2288+
Secret string `json:"secret"`
2289+
URL string `json:"url"`
2290+
} `json:"config"`
2291+
CreatedAt time.Time `json:"created_at"`
2292+
UpdatedAt time.Time `json:"updated_at"`
2293+
} `json:"hook"`
2294+
Repository struct {
2295+
ID int64 `json:"id"`
2296+
NodeID string `json:"node_id"`
2297+
Name string `json:"name"`
2298+
FullName string `json:"full_name"`
2299+
Owner struct {
2300+
Login string `json:"login"`
2301+
ID int64 `json:"id"`
2302+
NodeID string `json:"node_id"`
2303+
AvatarURL string `json:"avatar_url"`
2304+
GravatarID string `json:"gravatar_id"`
2305+
URL string `json:"url"`
2306+
HTMLURL string `json:"html_url"`
2307+
FollowersURL string `json:"followers_url"`
2308+
FollowingURL string `json:"following_url"`
2309+
GistsURL string `json:"gists_url"`
2310+
StarredURL string `json:"starred_url"`
2311+
SubscriptionsURL string `json:"subscriptions_url"`
2312+
OrganizationsURL string `json:"organizations_url"`
2313+
ReposURL string `json:"repos_url"`
2314+
EventsURL string `json:"events_url"`
2315+
ReceivedEventsURL string `json:"received_events_url"`
2316+
Type string `json:"type"`
2317+
SiteAdmin bool `json:"site_admin"`
2318+
} `json:"owner"`
2319+
Private bool `json:"private"`
2320+
HTMLURL string `json:"html_url"`
2321+
Description string `json:"description"`
2322+
Fork bool `json:"fork"`
2323+
URL string `json:"url"`
2324+
ForksURL string `json:"forks_url"`
2325+
KeysURL string `json:"keys_url"`
2326+
CollaboratorsURL string `json:"collaborators_url"`
2327+
TeamsURL string `json:"teams_url"`
2328+
HooksURL string `json:"hooks_url"`
2329+
IssueEventsURL string `json:"issue_events_url"`
2330+
EventsURL string `json:"events_url"`
2331+
AssigneesURL string `json:"assignees_url"`
2332+
BranchesURL string `json:"branches_url"`
2333+
TagsURL string `json:"tags_url"`
2334+
BlobsURL string `json:"blobs_url"`
2335+
GitTagsURL string `json:"git_tags_url"`
2336+
GitRefsURL string `json:"git_refs_url"`
2337+
TreesURL string `json:"trees_url"`
2338+
StatusesURL string `json:"statuses_url"`
2339+
LanguagesURL string `json:"languages_url"`
2340+
StargazersURL string `json:"stargazers_url"`
2341+
ContributorsURL string `json:"contributors_url"`
2342+
SubscribersURL string `json:"subscribers_url"`
2343+
SubscriptionURL string `json:"subscription_url"`
2344+
CommitsURL string `json:"commits_url"`
2345+
GitCommitsURL string `json:"git_commits_url"`
2346+
CommentsURL string `json:"comments_url"`
2347+
IssueCommentURL string `json:"issue_comment_url"`
2348+
ContentsURL string `json:"contents_url"`
2349+
CompareURL string `json:"compare_url"`
2350+
MergesURL string `json:"merges_url"`
2351+
ArchiveURL string `json:"archive_url"`
2352+
DownloadsURL string `json:"downloads_url"`
2353+
IssuesURL string `json:"issues_url"`
2354+
PullsURL string `json:"pulls_url"`
2355+
MilestonesURL string `json:"milestones_url"`
2356+
NotificationsURL string `json:"notifications_url"`
2357+
LabelsURL string `json:"labels_url"`
2358+
ReleasesURL string `json:"releases_url"`
2359+
CreatedAt time.Time `json:"created_at"`
2360+
UpdatedAt time.Time `json:"updated_at"`
2361+
PushedAt time.Time `json:"pushed_at"`
2362+
GitURL string `json:"git_url"`
2363+
SSHURL string `json:"ssh_url"`
2364+
CloneURL string `json:"clone_url"`
2365+
SvnURL string `json:"svn_url"`
2366+
Homepage *string `json:"homepage"`
2367+
Size int64 `json:"size"`
2368+
StargazersCount int64 `json:"stargazers_count"`
2369+
WatchersCount int64 `json:"watchers_count"`
2370+
Language *string `json:"language"`
2371+
HasIssues bool `json:"has_issues"`
2372+
HasDownloads bool `json:"has_downloads"`
2373+
HasWiki bool `json:"has_wiki"`
2374+
HasPages bool `json:"has_pages"`
2375+
ForksCount int64 `json:"forks_count"`
2376+
MirrorURL *string `json:"mirror_url"`
2377+
OpenIssuesCount int64 `json:"open_issues_count"`
2378+
Forks int64 `json:"forks"`
2379+
OpenIssues int64 `json:"open_issues"`
2380+
Watchers int64 `json:"watchers"`
2381+
DefaultBranch string `json:"default_branch"`
2382+
} `json:"repository"`
2383+
Sender struct {
2384+
Login string `json:"login"`
2385+
ID int64 `json:"id"`
2386+
NodeID string `json:"node_id"`
2387+
AvatarURL string `json:"avatar_url"`
2388+
GravatarID string `json:"gravatar_id"`
2389+
URL string `json:"url"`
2390+
HTMLURL string `json:"html_url"`
2391+
FollowersURL string `json:"followers_url"`
2392+
FollowingURL string `json:"following_url"`
2393+
GistsURL string `json:"gists_url"`
2394+
StarredURL string `json:"starred_url"`
2395+
SubscriptionsURL string `json:"subscriptions_url"`
2396+
OrganizationsURL string `json:"organizations_url"`
2397+
ReposURL string `json:"repos_url"`
2398+
EventsURL string `json:"events_url"`
2399+
ReceivedEventsURL string `json:"received_events_url"`
2400+
Type string `json:"type"`
2401+
SiteAdmin bool `json:"site_admin"`
2402+
} `json:"sender"`
2403+
}
2404+
22742405
// MilestonePayload contains the information for GitHub's milestone hook event
22752406
type MilestonePayload struct {
22762407
Action string `json:"action"`

0 commit comments

Comments
 (0)