Merge branch 'v5' into github-meta-event
This commit is contained in:
+41
-40
@@ -28,45 +28,46 @@ type Event string
|
||||
|
||||
// GitHub hook types
|
||||
const (
|
||||
CheckRunEvent Event = "check_run"
|
||||
CheckSuiteEvent Event = "check_suite"
|
||||
CommitCommentEvent Event = "commit_comment"
|
||||
CreateEvent Event = "create"
|
||||
DeleteEvent Event = "delete"
|
||||
DeploymentEvent Event = "deployment"
|
||||
DeploymentStatusEvent Event = "deployment_status"
|
||||
ForkEvent Event = "fork"
|
||||
GollumEvent Event = "gollum"
|
||||
InstallationEvent Event = "installation"
|
||||
InstallationRepositoriesEvent Event = "installation_repositories"
|
||||
IntegrationInstallationEvent Event = "integration_installation"
|
||||
IssueCommentEvent Event = "issue_comment"
|
||||
IssuesEvent Event = "issues"
|
||||
LabelEvent Event = "label"
|
||||
MemberEvent Event = "member"
|
||||
MembershipEvent Event = "membership"
|
||||
MilestoneEvent Event = "milestone"
|
||||
MetaEvent Event = "meta"
|
||||
OrganizationEvent Event = "organization"
|
||||
OrgBlockEvent Event = "org_block"
|
||||
PageBuildEvent Event = "page_build"
|
||||
PingEvent Event = "ping"
|
||||
ProjectCardEvent Event = "project_card"
|
||||
ProjectColumnEvent Event = "project_column"
|
||||
ProjectEvent Event = "project"
|
||||
PublicEvent Event = "public"
|
||||
PullRequestEvent Event = "pull_request"
|
||||
PullRequestReviewEvent Event = "pull_request_review"
|
||||
PullRequestReviewCommentEvent Event = "pull_request_review_comment"
|
||||
PushEvent Event = "push"
|
||||
ReleaseEvent Event = "release"
|
||||
RepositoryEvent Event = "repository"
|
||||
RepositoryVulnerabilityAlertEvent Event = "repository_vulnerability_alert"
|
||||
SecurityAdvisoryEvent Event = "security_advisory"
|
||||
StatusEvent Event = "status"
|
||||
TeamEvent Event = "team"
|
||||
TeamAddEvent Event = "team_add"
|
||||
WatchEvent Event = "watch"
|
||||
CheckRunEvent Event = "check_run"
|
||||
CheckSuiteEvent Event = "check_suite"
|
||||
CommitCommentEvent Event = "commit_comment"
|
||||
CreateEvent Event = "create"
|
||||
DeleteEvent Event = "delete"
|
||||
DeploymentEvent Event = "deployment"
|
||||
DeploymentStatusEvent Event = "deployment_status"
|
||||
ForkEvent Event = "fork"
|
||||
GollumEvent Event = "gollum"
|
||||
InstallationEvent Event = "installation"
|
||||
InstallationRepositoriesEvent Event = "installation_repositories"
|
||||
IntegrationInstallationEvent Event = "integration_installation"
|
||||
IntegrationInstallationRepositoriesEvent Event = "integration_installation_repositories"
|
||||
IssueCommentEvent Event = "issue_comment"
|
||||
IssuesEvent Event = "issues"
|
||||
LabelEvent Event = "label"
|
||||
MemberEvent Event = "member"
|
||||
MembershipEvent Event = "membership"
|
||||
MilestoneEvent Event = "milestone"
|
||||
MetaEvent Event = "meta"
|
||||
OrganizationEvent Event = "organization"
|
||||
OrgBlockEvent Event = "org_block"
|
||||
PageBuildEvent Event = "page_build"
|
||||
PingEvent Event = "ping"
|
||||
ProjectCardEvent Event = "project_card"
|
||||
ProjectColumnEvent Event = "project_column"
|
||||
ProjectEvent Event = "project"
|
||||
PublicEvent Event = "public"
|
||||
PullRequestEvent Event = "pull_request"
|
||||
PullRequestReviewEvent Event = "pull_request_review"
|
||||
PullRequestReviewCommentEvent Event = "pull_request_review_comment"
|
||||
PushEvent Event = "push"
|
||||
ReleaseEvent Event = "release"
|
||||
RepositoryEvent Event = "repository"
|
||||
RepositoryVulnerabilityAlertEvent Event = "repository_vulnerability_alert"
|
||||
SecurityAdvisoryEvent Event = "security_advisory"
|
||||
StatusEvent Event = "status"
|
||||
TeamEvent Event = "team"
|
||||
TeamAddEvent Event = "team_add"
|
||||
WatchEvent Event = "watch"
|
||||
)
|
||||
|
||||
// EventSubtype defines a GitHub Hook Event subtype
|
||||
@@ -207,7 +208,7 @@ func (hook Webhook) Parse(r *http.Request, events ...Event) (interface{}, error)
|
||||
var pl InstallationPayload
|
||||
err = json.Unmarshal([]byte(payload), &pl)
|
||||
return pl, err
|
||||
case InstallationRepositoriesEvent:
|
||||
case InstallationRepositoriesEvent, IntegrationInstallationRepositoriesEvent:
|
||||
var pl InstallationRepositoriesPayload
|
||||
err = json.Unmarshal([]byte(payload), &pl)
|
||||
return pl, err
|
||||
|
||||
@@ -253,6 +253,16 @@ func TestWebhooks(t *testing.T) {
|
||||
"X-Hub-Signature": []string{"sha1=bb2769f05f1a11af3a1edf8f9fac11bae7402a1e"},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "IntegrationInstallationRepositoriesEvent",
|
||||
event: IntegrationInstallationRepositoriesEvent,
|
||||
typ: InstallationRepositoriesPayload{},
|
||||
filename: "../testdata/github/integration-installation-repositories.json",
|
||||
headers: http.Header{
|
||||
"X-Github-Event": []string{"integration_installation_repositories"},
|
||||
"X-Hub-Signature": []string{"sha1=2f00a982574188342c2894eb9d1b1e93434687fb"},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "IssueCommentEvent",
|
||||
event: IssueCommentEvent,
|
||||
|
||||
@@ -5270,6 +5270,9 @@ type ReleasePayload struct {
|
||||
Type string `json:"type"`
|
||||
SiteAdmin bool `json:"site_admin"`
|
||||
} `json:"sender"`
|
||||
Installation struct {
|
||||
ID int `json:"id"`
|
||||
} `json:"installation"`
|
||||
}
|
||||
|
||||
// RepositoryPayload contains the information for GitHub's repository hook event
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"action": "removed",
|
||||
"installation": {
|
||||
"id": 2,
|
||||
"account": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"node_id": "MDQ6VXNlcjE=",
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"repository_selection": "selected",
|
||||
"access_tokens_url": "https://api.github.com/installations/2/access_tokens",
|
||||
"repositories_url": "https://api.github.com/installation/repositories",
|
||||
"html_url": "https://github.com/settings/installations/2",
|
||||
"app_id": 5725,
|
||||
"target_id": 3880403,
|
||||
"target_type": "User",
|
||||
"permissions": {
|
||||
"metadata": "read",
|
||||
"contents": "read",
|
||||
"issues": "write"
|
||||
},
|
||||
"events": [
|
||||
"push",
|
||||
"pull_request"
|
||||
],
|
||||
"created_at": 1525109898,
|
||||
"updated_at": 1525109899,
|
||||
"single_file_name": "config.yml"
|
||||
},
|
||||
"repository_selection": "selected",
|
||||
"repositories_added": [],
|
||||
"repositories_removed": [
|
||||
{
|
||||
"id": 1296269,
|
||||
"name": "Hello-World",
|
||||
"full_name": "octocat/Hello-World",
|
||||
"private": false
|
||||
}
|
||||
],
|
||||
"sender": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"node_id": "MDQ6VXNlcjE=",
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user