Skip to content

Update RepoWebhookEvent #461

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 38 additions & 14 deletions src/GitHub/Data/Webhooks.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,21 @@ data RepoWebhookEvent
= WebhookWildcardEvent
| WebhookCheckRunEvent
| WebhookCheckSuiteEvent
| WebhookCodeScanningAlert
| WebhookCommitCommentEvent
| WebhookContentReferenceEvent
| WebhookCreateEvent
| WebhookDeleteEvent
| WebhookDeployKeyEvent
| WebhookDeploymentEvent
| WebhookDeploymentStatusEvent
| WebhookDiscussion
| WebhookDiscussionComment
| WebhookDownloadEvent
| WebhookFollowEvent
| WebhookForkEvent
| WebhookForkApplyEvent
| WebhookGitHubAppAuthorizationEvent
| WebhookGistEvent
| WebhookGitHubAppAuthorizationEvent
| WebhookGollumEvent
| WebhookInstallationEvent
| WebhookInstallationRepositoriesEvent
Expand All @@ -59,29 +61,35 @@ data RepoWebhookEvent
| WebhookMembershipEvent
| WebhookMetaEvent
| WebhookMilestoneEvent
| WebhookOrganizationEvent
| WebhookOrgBlockEvent
| WebhookOrganizationEvent
| WebhookPackage
| WebhookPageBuildEvent
| WebhookPingEvent
| WebhookProjectCardEvent
| WebhookProjectColumnEvent
| WebhookProjectEvent
| WebhookPublicEvent
| WebhookPullRequestEvent
| WebhookPullRequestReviewEvent
| WebhookPullRequestReviewCommentEvent
| WebhookPullRequestReviewEvent
| WebhookPushEvent
| WebhookRegistryPackageEvent
| WebhookReleaseEvent
| WebhookRepositoryDispatch
| WebhookRepositoryEvent
| WebhookRepositoryImportEvent
| WebhookRepositoryVulnerabilityAlertEvent
| WebhookSecretScanningAlert
| WebhookSecurityAdvisoryEvent
| WebhookSponsorship
| WebhookStarEvent
| WebhookStatusEvent
| WebhookTeamEvent
| WebhookTeamAddEvent
| WebhookTeamEvent
| WebhookWatchEvent
| WebhookWorkflowDispatch
| WebhookWorkflowRun
deriving (Show, Data, Typeable, Eq, Ord, Generic)

instance NFData RepoWebhookEvent where rnf = genericRnf
Expand Down Expand Up @@ -137,19 +145,21 @@ instance FromJSON RepoWebhookEvent where
"*" -> pure WebhookWildcardEvent
"check_run" -> pure WebhookCheckRunEvent
"check_suite" -> pure WebhookCheckSuiteEvent
"code_scanning_alert" -> pure WebhookCodeScanningAlert
"commit_comment" -> pure WebhookCommitCommentEvent
"content_reference" -> pure WebhookContentReferenceEvent
"create" -> pure WebhookCreateEvent
"delete" -> pure WebhookDeleteEvent
"deploy_key" -> pure WebhookDeployKeyEvent
"deployment" -> pure WebhookDeploymentEvent
"deployment_status" -> pure WebhookDeploymentStatusEvent
"discussion" -> pure WebhookDiscussion
"discussion_comment" -> pure WebhookDiscussionComment
"download" -> pure WebhookDownloadEvent
"follow" -> pure WebhookFollowEvent
"fork" -> pure WebhookForkEvent
"fork_apply" -> pure WebhookForkApplyEvent
"github_app_authorization" -> pure WebhookGitHubAppAuthorizationEvent
"gist" -> pure WebhookGistEvent
"github_app_authorization" -> pure WebhookGitHubAppAuthorizationEvent
"gollum" -> pure WebhookGollumEvent
"installation" -> pure WebhookInstallationEvent
"installation_repositories" -> pure WebhookInstallationRepositoriesEvent
Expand All @@ -161,13 +171,14 @@ instance FromJSON RepoWebhookEvent where
"membership" -> pure WebhookMembershipEvent
"meta" -> pure WebhookMetaEvent
"milestone" -> pure WebhookMilestoneEvent
"organization" -> pure WebhookOrganizationEvent
"org_block" -> pure WebhookOrgBlockEvent
"organization" -> pure WebhookOrganizationEvent
"package" -> pure WebhookPackage
"page_build" -> pure WebhookPageBuildEvent
"ping" -> pure WebhookPingEvent
"project" -> pure WebhookProjectEvent
"project_card" -> pure WebhookProjectCardEvent
"project_column" -> pure WebhookProjectColumnEvent
"project" -> pure WebhookProjectEvent
"public" -> pure WebhookPublicEvent
"pull_request" -> pure WebhookPullRequestEvent
"pull_request_review" -> pure WebhookPullRequestReviewEvent
Expand All @@ -176,33 +187,40 @@ instance FromJSON RepoWebhookEvent where
"registry_package" -> pure WebhookRegistryPackageEvent
"release" -> pure WebhookReleaseEvent
"repository" -> pure WebhookRepositoryEvent
"repository_dispatch" -> pure WebhookRepositoryDispatch
"repository_import" -> pure WebhookRepositoryImportEvent
"repository_vulnerability_alert" -> pure WebhookRepositoryVulnerabilityAlertEvent
"secret_scanning_alert" -> pure WebhookSecretScanningAlert
"security_advisory" -> pure WebhookSecurityAdvisoryEvent
"sponsorship" -> pure WebhookSponsorship
"star" -> pure WebhookStarEvent
"status" -> pure WebhookStatusEvent
"team" -> pure WebhookTeamEvent
"team_add" -> pure WebhookTeamAddEvent
"watch" -> pure WebhookWatchEvent
"workflow_dispatch" -> pure WebhookWorkflowDispatch
"workflow_run" -> pure WebhookWorkflowRun
_ -> fail $ "Unknown RepoWebhookEvent: " <> T.unpack t

instance ToJSON RepoWebhookEvent where
toJSON WebhookWildcardEvent = String "*"
toJSON WebhookCheckRunEvent = String "check_run"
toJSON WebhookCheckSuiteEvent = String "check_suite"
toJSON WebhookCodeScanningAlert = String "code_scanning_alert"
toJSON WebhookCommitCommentEvent = String "commit_comment"
toJSON WebhookContentReferenceEvent = String "content_reference"
toJSON WebhookCreateEvent = String "create"
toJSON WebhookDeleteEvent = String "delete"
toJSON WebhookDeployKeyEvent = String "deploy_key"
toJSON WebhookDeploymentEvent = String "deployment"
toJSON WebhookDeploymentStatusEvent = String "deployment_status"
toJSON WebhookDiscussion = String "discussion"
toJSON WebhookDiscussionComment = String "discussion_comment"
toJSON WebhookDownloadEvent = String "download"
toJSON WebhookFollowEvent = String "follow"
toJSON WebhookForkEvent = String "fork"
toJSON WebhookForkApplyEvent = String "fork_apply"
toJSON WebhookGitHubAppAuthorizationEvent = String "github_app_authorization"
toJSON WebhookGistEvent = String "gist"
toJSON WebhookGitHubAppAuthorizationEvent = String "github_app_authorization"
toJSON WebhookGollumEvent = String "gollum"
toJSON WebhookInstallationEvent = String "installation"
toJSON WebhookInstallationRepositoriesEvent = String "installation_repositories"
Expand All @@ -214,29 +232,35 @@ instance ToJSON RepoWebhookEvent where
toJSON WebhookMembershipEvent = String "membership"
toJSON WebhookMetaEvent = String "meta"
toJSON WebhookMilestoneEvent = String "milestone"
toJSON WebhookOrganizationEvent = String "organization"
toJSON WebhookOrgBlockEvent = String "org_block"
toJSON WebhookOrganizationEvent = String "organization"
toJSON WebhookPackage = String "package"
toJSON WebhookPageBuildEvent = String "page_build"
toJSON WebhookPingEvent = String "ping"
toJSON WebhookProjectCardEvent = String "project_card"
toJSON WebhookProjectColumnEvent = String "project_column"
toJSON WebhookProjectEvent = String "project"
toJSON WebhookPublicEvent = String "public"
toJSON WebhookPullRequestEvent = String "pull_request"
toJSON WebhookPullRequestReviewEvent = String "pull_request_review"
toJSON WebhookPullRequestReviewCommentEvent = String "pull_request_review_comment"
toJSON WebhookPullRequestReviewEvent = String "pull_request_review"
toJSON WebhookPushEvent = String "push"
toJSON WebhookRegistryPackageEvent = String "registry_package"
toJSON WebhookReleaseEvent = String "release"
toJSON WebhookRepositoryDispatch = String "repository_dispatch"
toJSON WebhookRepositoryEvent = String "repository"
toJSON WebhookRepositoryImportEvent = String "repository_import"
toJSON WebhookRepositoryVulnerabilityAlertEvent = String "repository_vulnerability_alert"
toJSON WebhookSecretScanningAlert = String "secret_scanning_alert"
toJSON WebhookSecurityAdvisoryEvent = String "security_advisory"
toJSON WebhookSponsorship = String "sponsorship"
toJSON WebhookStarEvent = String "star"
toJSON WebhookStatusEvent = String "status"
toJSON WebhookTeamEvent = String "team"
toJSON WebhookTeamAddEvent = String "team_add"
toJSON WebhookTeamEvent = String "team"
toJSON WebhookWatchEvent = String "watch"
toJSON WebhookWorkflowDispatch = String "workflow_dispatch"
toJSON WebhookWorkflowRun = String "workflow_run"

instance FromJSON RepoWebhook where
parseJSON = withObject "RepoWebhook" $ \o -> RepoWebhook
Expand Down