Skip to content

Commit 7e00036

Browse files
fixed meta and page-build payload
1 parent 5228391 commit 7e00036

File tree

3 files changed

+17
-195
lines changed

3 files changed

+17
-195
lines changed

github/payload.go

Lines changed: 10 additions & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,114 +1178,24 @@ type MembershipPayload struct {
11781178

11791179
// MetaPayload contains the information for GitHub's meta hook event
11801180
type MetaPayload struct {
1181-
HookID int `json:"hook_id"`
1181+
HookID int `json:"hook_id"`
1182+
Action string `json:"action"`
11821183
Hook struct {
11831184
Type string `json:"type"`
11841185
ID int64 `json:"id"`
1185-
NodeID string `json:"node_id"`
11861186
Name string `json:"name"`
11871187
Active bool `json:"active"`
11881188
Events []string `json:"events"`
1189-
AppID int `json:"app_id"`
11901189
Config struct {
11911190
ContentType string `json:"content_type"`
11921191
InsecureSSL string `json:"insecure_ssl"`
1193-
Secret string `json:"secret"`
11941192
URL string `json:"url"`
11951193
} `json:"config"`
11961194
CreatedAt time.Time `json:"created_at"`
11971195
UpdatedAt time.Time `json:"updated_at"`
11981196
} `json:"hook"`
1199-
Repository struct {
1200-
ID int64 `json:"id"`
1201-
NodeID string `json:"node_id"`
1202-
Name string `json:"name"`
1203-
FullName string `json:"full_name"`
1204-
Owner struct {
1205-
Login string `json:"login"`
1206-
ID int64 `json:"id"`
1207-
NodeID string `json:"node_id"`
1208-
AvatarURL string `json:"avatar_url"`
1209-
GravatarID string `json:"gravatar_id"`
1210-
URL string `json:"url"`
1211-
HTMLURL string `json:"html_url"`
1212-
FollowersURL string `json:"followers_url"`
1213-
FollowingURL string `json:"following_url"`
1214-
GistsURL string `json:"gists_url"`
1215-
StarredURL string `json:"starred_url"`
1216-
SubscriptionsURL string `json:"subscriptions_url"`
1217-
OrganizationsURL string `json:"organizations_url"`
1218-
ReposURL string `json:"repos_url"`
1219-
EventsURL string `json:"events_url"`
1220-
ReceivedEventsURL string `json:"received_events_url"`
1221-
Type string `json:"type"`
1222-
SiteAdmin bool `json:"site_admin"`
1223-
} `json:"owner"`
1224-
Private bool `json:"private"`
1225-
HTMLURL string `json:"html_url"`
1226-
Description string `json:"description"`
1227-
Fork bool `json:"fork"`
1228-
URL string `json:"url"`
1229-
ForksURL string `json:"forks_url"`
1230-
KeysURL string `json:"keys_url"`
1231-
CollaboratorsURL string `json:"collaborators_url"`
1232-
TeamsURL string `json:"teams_url"`
1233-
HooksURL string `json:"hooks_url"`
1234-
IssueEventsURL string `json:"issue_events_url"`
1235-
EventsURL string `json:"events_url"`
1236-
AssigneesURL string `json:"assignees_url"`
1237-
BranchesURL string `json:"branches_url"`
1238-
TagsURL string `json:"tags_url"`
1239-
BlobsURL string `json:"blobs_url"`
1240-
GitTagsURL string `json:"git_tags_url"`
1241-
GitRefsURL string `json:"git_refs_url"`
1242-
TreesURL string `json:"trees_url"`
1243-
StatusesURL string `json:"statuses_url"`
1244-
LanguagesURL string `json:"languages_url"`
1245-
StargazersURL string `json:"stargazers_url"`
1246-
ContributorsURL string `json:"contributors_url"`
1247-
SubscribersURL string `json:"subscribers_url"`
1248-
SubscriptionURL string `json:"subscription_url"`
1249-
CommitsURL string `json:"commits_url"`
1250-
GitCommitsURL string `json:"git_commits_url"`
1251-
CommentsURL string `json:"comments_url"`
1252-
IssueCommentURL string `json:"issue_comment_url"`
1253-
ContentsURL string `json:"contents_url"`
1254-
CompareURL string `json:"compare_url"`
1255-
MergesURL string `json:"merges_url"`
1256-
ArchiveURL string `json:"archive_url"`
1257-
DownloadsURL string `json:"downloads_url"`
1258-
IssuesURL string `json:"issues_url"`
1259-
PullsURL string `json:"pulls_url"`
1260-
MilestonesURL string `json:"milestones_url"`
1261-
NotificationsURL string `json:"notifications_url"`
1262-
LabelsURL string `json:"labels_url"`
1263-
ReleasesURL string `json:"releases_url"`
1264-
CreatedAt time.Time `json:"created_at"`
1265-
UpdatedAt time.Time `json:"updated_at"`
1266-
PushedAt time.Time `json:"pushed_at"`
1267-
GitURL string `json:"git_url"`
1268-
SSHURL string `json:"ssh_url"`
1269-
CloneURL string `json:"clone_url"`
1270-
SvnURL string `json:"svn_url"`
1271-
Homepage *string `json:"homepage"`
1272-
Size int64 `json:"size"`
1273-
StargazersCount int64 `json:"stargazers_count"`
1274-
WatchersCount int64 `json:"watchers_count"`
1275-
Language *string `json:"language"`
1276-
HasIssues bool `json:"has_issues"`
1277-
HasDownloads bool `json:"has_downloads"`
1278-
HasWiki bool `json:"has_wiki"`
1279-
HasPages bool `json:"has_pages"`
1280-
ForksCount int64 `json:"forks_count"`
1281-
MirrorURL *string `json:"mirror_url"`
1282-
OpenIssuesCount int64 `json:"open_issues_count"`
1283-
Forks int64 `json:"forks"`
1284-
OpenIssues int64 `json:"open_issues"`
1285-
Watchers int64 `json:"watchers"`
1286-
DefaultBranch string `json:"default_branch"`
1287-
} `json:"repository"`
1288-
Sender struct {
1197+
Repository Repository `json:"repository"`
1198+
Sender struct {
12891199
Login string `json:"login"`
12901200
ID int64 `json:"id"`
12911201
NodeID string `json:"node_id"`
@@ -1305,6 +1215,7 @@ type MetaPayload struct {
13051215
Type string `json:"type"`
13061216
SiteAdmin bool `json:"site_admin"`
13071217
} `json:"sender"`
1218+
Installation Installation `json:"installation"`
13081219
}
13091220

13101221
// MilestonePayload contains the information for GitHub's milestone hook event
@@ -1499,9 +1410,8 @@ type OrgBlockPayload struct {
14991410

15001411
// PageBuildPayload contains the information for GitHub's page_build hook event
15011412
type PageBuildPayload struct {
1502-
ID int64 `json:"id"`
1503-
NodeID string `json:"node_id"`
1504-
Build struct {
1413+
ID int64 `json:"id"`
1414+
Build struct {
15051415
URL string `json:"url"`
15061416
Status string `json:"status"`
15071417
Error struct {
@@ -1532,96 +1442,8 @@ type PageBuildPayload struct {
15321442
CreatedAt time.Time `json:"created_at"`
15331443
UpdatedAt time.Time `json:"updated_at"`
15341444
} `json:"build"`
1535-
Repository struct {
1536-
ID int64 `json:"id"`
1537-
NodeID string `json:"node_id"`
1538-
Name string `json:"name"`
1539-
FullName string `json:"full_name"`
1540-
Owner struct {
1541-
Login string `json:"login"`
1542-
ID int64 `json:"id"`
1543-
NodeID string `json:"node_id"`
1544-
AvatarURL string `json:"avatar_url"`
1545-
GravatarID string `json:"gravatar_id"`
1546-
URL string `json:"url"`
1547-
HTMLURL string `json:"html_url"`
1548-
FollowersURL string `json:"followers_url"`
1549-
FollowingURL string `json:"following_url"`
1550-
GistsURL string `json:"gists_url"`
1551-
StarredURL string `json:"starred_url"`
1552-
SubscriptionsURL string `json:"subscriptions_url"`
1553-
OrganizationsURL string `json:"organizations_url"`
1554-
ReposURL string `json:"repos_url"`
1555-
EventsURL string `json:"events_url"`
1556-
ReceivedEventsURL string `json:"received_events_url"`
1557-
Type string `json:"type"`
1558-
SiteAdmin bool `json:"site_admin"`
1559-
} `json:"owner"`
1560-
Private bool `json:"private"`
1561-
HTMLURL string `json:"html_url"`
1562-
Description string `json:"description"`
1563-
Fork bool `json:"fork"`
1564-
URL string `json:"url"`
1565-
ForksURL string `json:"forks_url"`
1566-
KeysURL string `json:"keys_url"`
1567-
CollaboratorsURL string `json:"collaborators_url"`
1568-
TeamsURL string `json:"teams_url"`
1569-
HooksURL string `json:"hooks_url"`
1570-
IssueEventsURL string `json:"issue_events_url"`
1571-
EventsURL string `json:"events_url"`
1572-
AssigneesURL string `json:"assignees_url"`
1573-
BranchesURL string `json:"branches_url"`
1574-
TagsURL string `json:"tags_url"`
1575-
BlobsURL string `json:"blobs_url"`
1576-
GitTagsURL string `json:"git_tags_url"`
1577-
GitRefsURL string `json:"git_refs_url"`
1578-
TreesURL string `json:"trees_url"`
1579-
StatusesURL string `json:"statuses_url"`
1580-
LanguagesURL string `json:"languages_url"`
1581-
StargazersURL string `json:"stargazers_url"`
1582-
ContributorsURL string `json:"contributors_url"`
1583-
SubscribersURL string `json:"subscribers_url"`
1584-
SubscriptionURL string `json:"subscription_url"`
1585-
CommitsURL string `json:"commits_url"`
1586-
GitCommitsURL string `json:"git_commits_url"`
1587-
CommentsURL string `json:"comments_url"`
1588-
IssueCommentURL string `json:"issue_comment_url"`
1589-
ContentsURL string `json:"contents_url"`
1590-
CompareURL string `json:"compare_url"`
1591-
MergesURL string `json:"merges_url"`
1592-
ArchiveURL string `json:"archive_url"`
1593-
DownloadsURL string `json:"downloads_url"`
1594-
IssuesURL string `json:"issues_url"`
1595-
PullsURL string `json:"pulls_url"`
1596-
MilestonesURL string `json:"milestones_url"`
1597-
NotificationsURL string `json:"notifications_url"`
1598-
LabelsURL string `json:"labels_url"`
1599-
ReleasesURL string `json:"releases_url"`
1600-
CreatedAt time.Time `json:"created_at"`
1601-
UpdatedAt time.Time `json:"updated_at"`
1602-
PushedAt time.Time `json:"pushed_at"`
1603-
GitURL string `json:"git_url"`
1604-
SSHURL string `json:"ssh_url"`
1605-
CloneURL string `json:"clone_url"`
1606-
SvnURL string `json:"svn_url"`
1607-
Homepage *string `json:"homepage"`
1608-
Size int64 `json:"size"`
1609-
StargazersCount int64 `json:"stargazers_count"`
1610-
WatchersCount int64 `json:"watchers_count"`
1611-
Language *string `json:"language"`
1612-
HasIssues bool `json:"has_issues"`
1613-
HasDownloads bool `json:"has_downloads"`
1614-
HasWiki bool `json:"has_wiki"`
1615-
HasPages bool `json:"has_pages"`
1616-
ForksCount int64 `json:"forks_count"`
1617-
MirrorURL *string `json:"mirror_url"`
1618-
OpenIssuesCount int64 `json:"open_issues_count"`
1619-
Forks int64 `json:"forks"`
1620-
OpenIssues int64 `json:"open_issues"`
1621-
Watchers int64 `json:"watchers"`
1622-
DefaultBranch string `json:"default_branch"`
1623-
} `json:"repository"`
1624-
Sender struct {
1445+
Repository Repository `json:"repository"`
1446+
Sender struct {
16251447
Login string `json:"login"`
16261448
ID int64 `json:"id"`
16271449
NodeID string `json:"node_id"`
@@ -1641,6 +1463,7 @@ type PageBuildPayload struct {
16411463
Type string `json:"type"`
16421464
SiteAdmin bool `json:"site_admin"`
16431465
} `json:"sender"`
1466+
Installation Installation `json:"installation"`
16441467
}
16451468

16461469
// PingPayload contains the information for GitHub's ping hook event

github/payload_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ func TestPayloads(t *testing.T) {
129129
filename: "organization.json",
130130
typ: &OrganizationPayload{},
131131
},
132-
// {
133-
// name: "PageBuildPayload",
134-
// filename: "page-build.json",
135-
// typ: &PageBuildPayload{},
136-
// },
132+
{
133+
name: "PageBuildPayload",
134+
filename: "page-build.json",
135+
typ: &PageBuildPayload{},
136+
},
137137
// {
138138
// name: "PingPayload",
139139
// filename: "ping.json",

tmp/meta.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
"id": 101047067,
77
"name": "web",
88
"active": true,
9-
"events": [
10-
"meta"
11-
],
9+
"events": ["meta"],
1210
"config": {
1311
"content_type": "json",
1412
"insecure_ssl": "0",
@@ -42,6 +40,7 @@
4240
"type": "User",
4341
"site_admin": false
4442
},
43+
"disabled": false,
4544
"private": false,
4645
"html_url": "https://github.com/Codertocat/Hello-World",
4746
"description": null,

0 commit comments

Comments
 (0)