@@ -718,28 +718,17 @@ type PullRequestReviewCommentPayload struct {
718718
719719// PushPayload contains the information for GitHub's push hook event
720720type PushPayload struct {
721- Ref string `json:"ref"`
722- Before string `json:"before"`
723- After string `json:"after"`
724- Created bool `json:"created"`
725- Deleted bool `json:"deleted"`
726- Forced bool `json:"forced"`
727- BaseRef * string `json:"base_ref"`
728- Compare string `json:"compare"`
729- Commits []* Commit `json:"commits"`
730- HeadCommit * Commit `json:"head_commit"`
731- //TODO: the repository object for this payload is slightly different
732- //should we ignore or create a separate type?
733- //diff:
734- // +@ ["repository","master_branch"]
735- // +- "master"
736- // +@ ["repository","owner","email"]
737- // +- "21031067+Codertocat@users.noreply.github.com"
738- // +@ ["repository","owner","name"]
739- // +- "Codertocat"
740- // +@ ["repository","stargazers"]
741- // +- 0
742- Repository Repository `json:"repository"`
721+ Ref string `json:"ref"`
722+ Before string `json:"before"`
723+ After string `json:"after"`
724+ Created bool `json:"created"`
725+ Deleted bool `json:"deleted"`
726+ Forced bool `json:"forced"`
727+ BaseRef * string `json:"base_ref"`
728+ Compare string `json:"compare"`
729+ Commits []* Commit `json:"commits"`
730+ HeadCommit * Commit `json:"head_commit"`
731+ Repository PushRepository `json:"repository"`
743732 Pusher struct {
744733 Name string `json:"name"`
745734 Email string `json:"email"`
@@ -1053,6 +1042,30 @@ type User struct {
10531042 SiteAdmin bool `json:"site_admin"`
10541043}
10551044
1045+ // PushRepositoryOwner represents a user in a PushPayload which differs slightly from other user objects.
1046+ type PushRepositoryOwner struct {
1047+ Login string `json:"login"`
1048+ ID int64 `json:"id"`
1049+ NodeID string `json:"node_id"`
1050+ AvatarURL string `json:"avatar_url"`
1051+ GravatarID string `json:"gravatar_id"`
1052+ URL string `json:"url"`
1053+ HTMLURL string `json:"html_url"`
1054+ FollowersURL string `json:"followers_url"`
1055+ FollowingURL string `json:"following_url"`
1056+ GistsURL string `json:"gists_url"`
1057+ StarredURL string `json:"starred_url"`
1058+ SubscriptionsURL string `json:"subscriptions_url"`
1059+ OrganizationsURL string `json:"organizations_url"`
1060+ ReposURL string `json:"repos_url"`
1061+ EventsURL string `json:"events_url"`
1062+ ReceivedEventsURL string `json:"received_events_url"`
1063+ Type string `json:"type"`
1064+ SiteAdmin bool `json:"site_admin"`
1065+ Email string `json:"email"`
1066+ Name string `json:"name"`
1067+ }
1068+
10561069// Milestone contains GitHub's milestone information
10571070type Milestone struct {
10581071 URL string `json:"url"`
@@ -1183,6 +1196,86 @@ type Repository struct {
11831196 DefaultBranch string `json:"default_branch"`
11841197}
11851198
1199+ // PushRepository represents the repository object of a PushPayload,
1200+ // CreatedAt and PushedAt are integer timestamps instead of formatted dates.
1201+ type PushRepository struct {
1202+ ID int64 `json:"id"`
1203+ NodeID string `json:"node_id"`
1204+ Name string `json:"name"`
1205+ FullName string `json:"full_name"`
1206+ Owner PushRepositoryOwner `json:"owner"`
1207+ Private bool `json:"private"`
1208+ Archived bool `json:"archived"`
1209+ Disabled bool `json:"disabled"`
1210+ HTMLURL string `json:"html_url"`
1211+ Description * string `json:"description"`
1212+ Fork bool `json:"fork"`
1213+ URL string `json:"url"`
1214+ ForksURL string `json:"forks_url"`
1215+ KeysURL string `json:"keys_url"`
1216+ CollaboratorsURL string `json:"collaborators_url"`
1217+ TeamsURL string `json:"teams_url"`
1218+ HooksURL string `json:"hooks_url"`
1219+ IssueEventsURL string `json:"issue_events_url"`
1220+ EventsURL string `json:"events_url"`
1221+ AssigneesURL string `json:"assignees_url"`
1222+ BranchesURL string `json:"branches_url"`
1223+ TagsURL string `json:"tags_url"`
1224+ BlobsURL string `json:"blobs_url"`
1225+ GitTagsURL string `json:"git_tags_url"`
1226+ GitRefsURL string `json:"git_refs_url"`
1227+ TreesURL string `json:"trees_url"`
1228+ StatusesURL string `json:"statuses_url"`
1229+ LanguagesURL string `json:"languages_url"`
1230+ StargazersURL string `json:"stargazers_url"`
1231+ ContributorsURL string `json:"contributors_url"`
1232+ SubscribersURL string `json:"subscribers_url"`
1233+ SubscriptionURL string `json:"subscription_url"`
1234+ CommitsURL string `json:"commits_url"`
1235+ GitCommitsURL string `json:"git_commits_url"`
1236+ CommentsURL string `json:"comments_url"`
1237+ IssueCommentURL string `json:"issue_comment_url"`
1238+ ContentsURL string `json:"contents_url"`
1239+ CompareURL string `json:"compare_url"`
1240+ MergesURL string `json:"merges_url"`
1241+ ArchiveURL string `json:"archive_url"`
1242+ DownloadsURL string `json:"downloads_url"`
1243+ IssuesURL string `json:"issues_url"`
1244+ PullsURL string `json:"pulls_url"`
1245+ MilestonesURL string `json:"milestones_url"`
1246+ NotificationsURL string `json:"notifications_url"`
1247+ LabelsURL string `json:"labels_url"`
1248+ ReleasesURL string `json:"releases_url"`
1249+ CreatedAt int64 `json:"created_at"`
1250+ UpdatedAt time.Time `json:"updated_at"`
1251+ PushedAt int64 `json:"pushed_at"`
1252+ GitURL string `json:"git_url"`
1253+ SSHURL string `json:"ssh_url"`
1254+ CloneURL string `json:"clone_url"`
1255+ SvnURL string `json:"svn_url"`
1256+ DeploymentsURL string `json:"deployments_url"`
1257+ License * string `json:"license"`
1258+ Homepage * string `json:"homepage"`
1259+ Size int64 `json:"size"`
1260+ StargazersCount int64 `json:"stargazers_count"`
1261+ WatchersCount int64 `json:"watchers_count"`
1262+ Language * string `json:"language"`
1263+ HasIssues bool `json:"has_issues"`
1264+ HasDownloads bool `json:"has_downloads"`
1265+ HasWiki bool `json:"has_wiki"`
1266+ HasPages bool `json:"has_pages"`
1267+ HasProjects bool `json:"has_projects"`
1268+ ForksCount int64 `json:"forks_count"`
1269+ MirrorURL * string `json:"mirror_url"`
1270+ OpenIssuesCount int64 `json:"open_issues_count"`
1271+ Forks int64 `json:"forks"`
1272+ OpenIssues int64 `json:"open_issues"`
1273+ Watchers int64 `json:"watchers"`
1274+ DefaultBranch string `json:"default_branch"`
1275+ MasterBranch string `json:"master_branch"`
1276+ Stargazers int `json:"stargazers"`
1277+ }
1278+
11861279// Installation contains the ID of the installation of the app that recieved the payload
11871280type Installation struct {
11881281 ID int64 `json:"id"`
@@ -1294,9 +1387,7 @@ type Issue struct {
12941387
12951388// Commit contains information about a commit in a push payload
12961389type Commit struct {
1297- Sha string `json:"sha"`
12981390 ID string `json:"id"`
1299- NodeID string `json:"node_id"`
13001391 TreeID string `json:"tree_id"`
13011392 Distinct bool `json:"distinct"`
13021393 Message string `json:"message"`
0 commit comments