Skip to content

Commit

Permalink
feat: add union of all types in transition package
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfy1339 committed Nov 20, 2024
1 parent fa3c413 commit 4b7e91d
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 3 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"semantic-release-plugin-update-version-in-files",
{
"files": [
"packages/openapi-webhooks/generated/*"
"packages/openapi-webhooks/generated/*",
"packages/openapi-webhooks-types-transition/package.json"
]
}
],
Expand Down
75 changes: 74 additions & 1 deletion packages/openapi-webhooks-types-transition/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,79 @@ export type EventPayloadMap = {
| WebhookEventDefinition<"workflow_run.in_progress">
| WebhookEventDefinition<"workflow_run.requested">;
};
export type WebhookEvent = WebhookEventMap;
export type WebhookEvent =
| BranchProtectionConfigurationEvent
| BranchProtectionRuleEvent
| CheckRunEvent
| CheckSuiteEvent
| CodeScanningAlertEvent
| CommitCommentEvent
| CreateEvent
| CustomPropertyEvent
| CustomPropertyValuesEvent
| DeleteEvent
| DependabotAlertEvent
| DeployKeyEvent
| DeploymentEvent
| DeploymentProtectionRuleEvent
| DeploymentReviewEvent
| DeploymentStatusEvent
| DiscussionEvent
| DiscussionCommentEvent
| ForkEvent
| GithubAppAuthorizationEvent
| GollumEvent
| InstallationEvent
| InstallationRepositoriesEvent
| InstallationTargetEvent
| IssueCommentEvent
| IssuesEvent
| LabelEvent
| MarketplacePurchaseEvent
| MemberEvent
| MembershipEvent
| MergeGroupEvent
| MetaEvent
| MilestoneEvent
| OrgBlockEvent
| OrganizationEvent
| PackageEvent
| PageBuildEvent
| PersonalAccessTokenRequestEvent
| PingEvent
| ProjectCardEvent
| ProjectEvent
| ProjectColumnEvent
| ProjectsV2Event
| ProjectsV2ItemEvent
| ProjectsV2StatusUpdateEvent
| PublicEvent
| PullRequestEvent
| PullRequestReviewCommentEvent
| PullRequestReviewEvent
| PullRequestReviewThreadEvent
| PushEvent
| RegistryPackageEvent
| ReleaseEvent
| RepositoryAdvisoryEvent
| RepositoryEvent
| RepositoryDispatchEvent
| RepositoryImportEvent
| RepositoryRulesetEvent
| RepositoryVulnerabilityAlertEvent
| SecretScanningAlertEvent
| SecretScanningAlertLocationEvent
| SecurityAdvisoryEvent
| SecurityAndAnalysisEvent
| SponsorshipEvent
| StarEvent
| StatusEvent
| SubIssuesEvent
| TeamAddEvent
| TeamEvent
| WatchEvent
| WorkflowDispatchEvent
| WorkflowJobEvent
| WorkflowRunEvent;
export type WebhookEventMap = EventPayloadMap;
export type WebhookEventName = keyof EventPayloadMap;
5 changes: 4 additions & 1 deletion scripts/generate-transition-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ async function run() {
.join(" | ")}`
),
"};",
"export type WebhookEvent = WebhookEventMap;",
"export type WebhookEvent =",
Object.keys(eventsMap).map(
(eventName) => `${snakeToPascalCase(eventName)}Event`
).join(" | "),
"export type WebhookEventMap = EventPayloadMap;",
"export type WebhookEventName = keyof EventPayloadMap;"
);
Expand Down

0 comments on commit 4b7e91d

Please sign in to comment.