Skip to content

Commit 54b13aa

Browse files
committed
feat: add star event-payload
1 parent 02d182a commit 54b13aa

File tree

2 files changed

+157
-0
lines changed

2 files changed

+157
-0
lines changed

github/github.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ const (
6666
RepositoryEvent Event = "repository"
6767
RepositoryVulnerabilityAlertEvent Event = "repository_vulnerability_alert"
6868
SecurityAdvisoryEvent Event = "security_advisory"
69+
StarEvent Event = "star"
6970
StatusEvent Event = "status"
7071
TeamEvent Event = "team"
7172
TeamAddEvent Event = "team_add"
@@ -322,6 +323,10 @@ func (hook Webhook) Parse(r *http.Request, events ...Event) (interface{}, error)
322323
var pl SecurityAdvisoryPayload
323324
err = json.Unmarshal([]byte(payload), &pl)
324325
return pl, err
326+
case StarEvent:
327+
var pl StarPayload
328+
err = json.Unmarshal([]byte(payload), &pl)
329+
return pl, err
325330
case StatusEvent:
326331
var pl StatusPayload
327332
err = json.Unmarshal([]byte(payload), &pl)

github/payload.go

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5858,6 +5858,158 @@ type SecurityAdvisoryPayload struct {
58585858
} `json:"security_advisory"`
58595859
}
58605860

5861+
// StarPayload contains the information for GitHub's star hook event
5862+
type StarPayload struct {
5863+
Action string `json:"action"`
5864+
StarredAt *time.Time `json:"starred_at"`
5865+
Repository struct {
5866+
Id int `json:"id"`
5867+
NodeId string `json:"node_id"`
5868+
Name string `json:"name"`
5869+
FullName string `json:"full_name"`
5870+
Private bool `json:"private"`
5871+
Owner struct {
5872+
Login string `json:"login"`
5873+
Id int `json:"id"`
5874+
NodeId string `json:"node_id"`
5875+
AvatarUrl string `json:"avatar_url"`
5876+
GravatarId string `json:"gravatar_id"`
5877+
Url string `json:"url"`
5878+
HtmlUrl string `json:"html_url"`
5879+
FollowersUrl string `json:"followers_url"`
5880+
FollowingUrl string `json:"following_url"`
5881+
GistsUrl string `json:"gists_url"`
5882+
StarredUrl string `json:"starred_url"`
5883+
SubscriptionsUrl string `json:"subscriptions_url"`
5884+
OrganizationsUrl string `json:"organizations_url"`
5885+
ReposUrl string `json:"repos_url"`
5886+
EventsUrl string `json:"events_url"`
5887+
ReceivedEventsUrl string `json:"received_events_url"`
5888+
Type string `json:"type"`
5889+
SiteAdmin bool `json:"site_admin"`
5890+
} `json:"owner"`
5891+
HtmlUrl string `json:"html_url"`
5892+
Description string `json:"description"`
5893+
Fork bool `json:"fork"`
5894+
Url string `json:"url"`
5895+
ForksUrl string `json:"forks_url"`
5896+
KeysUrl string `json:"keys_url"`
5897+
CollaboratorsUrl string `json:"collaborators_url"`
5898+
TeamsUrl string `json:"teams_url"`
5899+
HooksUrl string `json:"hooks_url"`
5900+
IssueEventsUrl string `json:"issue_events_url"`
5901+
EventsUrl string `json:"events_url"`
5902+
AssigneesUrl string `json:"assignees_url"`
5903+
BranchesUrl string `json:"branches_url"`
5904+
TagsUrl string `json:"tags_url"`
5905+
BlobsUrl string `json:"blobs_url"`
5906+
GitTagsUrl string `json:"git_tags_url"`
5907+
GitRefsUrl string `json:"git_refs_url"`
5908+
TreesUrl string `json:"trees_url"`
5909+
StatusesUrl string `json:"statuses_url"`
5910+
LanguagesUrl string `json:"languages_url"`
5911+
StargazersUrl string `json:"stargazers_url"`
5912+
ContributorsUrl string `json:"contributors_url"`
5913+
SubscribersUrl string `json:"subscribers_url"`
5914+
SubscriptionUrl string `json:"subscription_url"`
5915+
CommitsUrl string `json:"commits_url"`
5916+
GitCommitsUrl string `json:"git_commits_url"`
5917+
CommentsUrl string `json:"comments_url"`
5918+
IssueCommentUrl string `json:"issue_comment_url"`
5919+
ContentsUrl string `json:"contents_url"`
5920+
CompareUrl string `json:"compare_url"`
5921+
MergesUrl string `json:"merges_url"`
5922+
ArchiveUrl string `json:"archive_url"`
5923+
DownloadsUrl string `json:"downloads_url"`
5924+
IssuesUrl string `json:"issues_url"`
5925+
PullsUrl string `json:"pulls_url"`
5926+
MilestonesUrl string `json:"milestones_url"`
5927+
NotificationsUrl string `json:"notifications_url"`
5928+
LabelsUrl string `json:"labels_url"`
5929+
ReleasesUrl string `json:"releases_url"`
5930+
DeploymentsUrl string `json:"deployments_url"`
5931+
CreatedAt time.Time `json:"created_at"`
5932+
UpdatedAt time.Time `json:"updated_at"`
5933+
PushedAt time.Time `json:"pushed_at"`
5934+
GitUrl string `json:"git_url"`
5935+
SshUrl string `json:"ssh_url"`
5936+
CloneUrl string `json:"clone_url"`
5937+
SvnUrl string `json:"svn_url"`
5938+
Homepage string `json:"homepage"`
5939+
Size int `json:"size"`
5940+
StargazersCount int `json:"stargazers_count"`
5941+
WatchersCount int `json:"watchers_count"`
5942+
Language string `json:"language"`
5943+
HasIssues bool `json:"has_issues"`
5944+
HasProjects bool `json:"has_projects"`
5945+
HasDownloads bool `json:"has_downloads"`
5946+
HasWiki bool `json:"has_wiki"`
5947+
HasPages bool `json:"has_pages"`
5948+
HasDiscussions bool `json:"has_discussions"`
5949+
ForksCount int `json:"forks_count"`
5950+
MirrorUrl interface{} `json:"mirror_url"`
5951+
Archived bool `json:"archived"`
5952+
Disabled bool `json:"disabled"`
5953+
OpenIssuesCount int `json:"open_issues_count"`
5954+
License interface{} `json:"license"`
5955+
AllowForking bool `json:"allow_forking"`
5956+
IsTemplate bool `json:"is_template"`
5957+
WebCommitSignoffRequired bool `json:"web_commit_signoff_required"`
5958+
Topics []string `json:"topics"`
5959+
Visibility string `json:"visibility"`
5960+
Forks int `json:"forks"`
5961+
OpenIssues int `json:"open_issues"`
5962+
Watchers int `json:"watchers"`
5963+
DefaultBranch string `json:"default_branch"`
5964+
} `json:"repository"`
5965+
Organization struct {
5966+
Login string `json:"login"`
5967+
Id int `json:"id"`
5968+
NodeId string `json:"node_id"`
5969+
Url string `json:"url"`
5970+
ReposUrl string `json:"repos_url"`
5971+
EventsUrl string `json:"events_url"`
5972+
HooksUrl string `json:"hooks_url"`
5973+
IssuesUrl string `json:"issues_url"`
5974+
MembersUrl string `json:"members_url"`
5975+
PublicMembersUrl string `json:"public_members_url"`
5976+
AvatarUrl string `json:"avatar_url"`
5977+
Description string `json:"description"`
5978+
} `json:"organization"`
5979+
Enterprise *struct {
5980+
Id int `json:"id"`
5981+
Slug string `json:"slug"`
5982+
Name string `json:"name"`
5983+
NodeId string `json:"node_id"`
5984+
AvatarUrl string `json:"avatar_url"`
5985+
Description string `json:"description"`
5986+
WebsiteUrl string `json:"website_url"`
5987+
HtmlUrl string `json:"html_url"`
5988+
CreatedAt time.Time `json:"created_at"`
5989+
UpdatedAt time.Time `json:"updated_at"`
5990+
} `json:"enterprise"`
5991+
Sender struct {
5992+
Login string `json:"login"`
5993+
Id int `json:"id"`
5994+
NodeId string `json:"node_id"`
5995+
AvatarUrl string `json:"avatar_url"`
5996+
GravatarId string `json:"gravatar_id"`
5997+
Url string `json:"url"`
5998+
HtmlUrl string `json:"html_url"`
5999+
FollowersUrl string `json:"followers_url"`
6000+
FollowingUrl string `json:"following_url"`
6001+
GistsUrl string `json:"gists_url"`
6002+
StarredUrl string `json:"starred_url"`
6003+
SubscriptionsUrl string `json:"subscriptions_url"`
6004+
OrganizationsUrl string `json:"organizations_url"`
6005+
ReposUrl string `json:"repos_url"`
6006+
EventsUrl string `json:"events_url"`
6007+
ReceivedEventsUrl string `json:"received_events_url"`
6008+
Type string `json:"type"`
6009+
SiteAdmin bool `json:"site_admin"`
6010+
} `json:"sender"`
6011+
}
6012+
58616013
// StatusPayload contains the information for GitHub's status hook event
58626014
type StatusPayload struct {
58636015
ID int64 `json:"id"`

0 commit comments

Comments
 (0)