@automate.ax/integration-contracts 0.88.2 → 0.88.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/github/additional-events.d.ts +219 -16710
  2. package/dist/github/additional-events.js +67 -98
  3. package/dist/github/index.d.ts +97 -2
  4. package/dist/github/index.js +382 -5
  5. package/dist/github/openapi-types.d.ts +21 -0
  6. package/dist/github/openapi-types.generated.d.ts +52350 -0
  7. package/dist/github/openapi-types.generated.js +1 -0
  8. package/dist/github/openapi-types.js +1 -0
  9. package/dist/github/resources.d.ts +7435 -17936
  10. package/dist/github/resources.js +40 -135
  11. package/dist/github/rest-schemas.d.ts +11 -0
  12. package/dist/github/rest-schemas.generated.json +1 -0
  13. package/dist/github/rest-schemas.js +24 -0
  14. package/dist/github/schemas.d.ts +4554 -7321
  15. package/dist/github/schemas.js +68 -77
  16. package/dist/github/webhook-operations.d.ts +52 -0
  17. package/dist/github/webhook-operations.js +134 -0
  18. package/dist/github/webhook-schemas.d.ts +12 -0
  19. package/dist/github/webhook-schemas.generated.json +1 -0
  20. package/dist/github/webhook-schemas.js +28 -0
  21. package/dist/linear/schemas.d.ts +1 -1
  22. package/dist/vercel/index.d.ts +12 -12
  23. package/dist/vercel/schemas.d.ts +18 -18
  24. package/package.json +6 -3
  25. package/src/github/additional-events.ts +631 -273
  26. package/src/github/index.ts +761 -8
  27. package/src/github/openapi-types.generated.ts +52352 -0
  28. package/src/github/openapi-types.ts +59 -0
  29. package/src/github/resources.ts +106 -303
  30. package/src/github/rest-schemas.generated.json +1 -0
  31. package/src/github/rest-schemas.ts +35 -0
  32. package/src/github/schemas.ts +593 -195
  33. package/src/github/webhook-operations.ts +171 -0
  34. package/src/github/webhook-schemas.generated.json +1 -0
  35. package/src/github/webhook-schemas.ts +43 -0
@@ -1,93 +1,72 @@
1
- import type { Encodable } from "@automate.ax/codec"
2
- import type { webhooks } from "@octokit/openapi-webhooks-types"
3
- import type { Octokit } from "@octokit/rest"
4
1
  import * as z from "zod"
2
+ import type {
3
+ GitHubRestResource,
4
+ GitHubWebhookPayload,
5
+ GitHubWebhookOperation,
6
+ } from "./openapi-types"
7
+ import { githubRestResourceSchema } from "./rest-schemas"
8
+ import {
9
+ githubWebhookEventSchema,
10
+ type GitHubWebhookSchema,
11
+ } from "./webhook-schemas"
5
12
 
6
13
  export * from "./resources"
7
14
  export * from "./additional-events"
15
+ export { getGitHubWebhookOperation } from "./webhook-operations"
16
+ export type { GitHubWebhookOperation } from "./openapi-types"
17
+ export type { GitHubWebhookEventName } from "./webhook-operations"
8
18
 
9
- const GITHUB_EVENT_BASE_SCHEMA = z.looseObject({
10
- installation: z.looseObject({ id: z.number().int().positive() }),
11
- repository: z.looseObject({
12
- full_name: z.string(),
13
- id: z.number().int().positive(),
14
- }),
15
- sender: z.looseObject({
16
- id: z.number().int().positive(),
17
- login: z.string(),
18
- }),
19
- })
20
- const GITHUB_ISSUE_EVENT_BASE_SCHEMA = GITHUB_EVENT_BASE_SCHEMA.extend({
21
- action: z.string(),
22
- issue: z.looseObject({ id: z.number(), number: z.number().int() }),
23
- })
24
- const GITHUB_PULL_REQUEST_EVENT_BASE_SCHEMA = GITHUB_EVENT_BASE_SCHEMA.extend({
25
- action: z.string(),
26
- pull_request: z.looseObject({
27
- id: z.number(),
28
- merged: z.boolean(),
29
- number: z.number().int(),
30
- }),
31
- })
32
- const GITHUB_PULL_REQUEST_REVIEW_EVENT_BASE_SCHEMA =
33
- GITHUB_PULL_REQUEST_EVENT_BASE_SCHEMA.extend({
34
- review: z.looseObject({ id: z.number() }),
35
- })
36
- const GITHUB_PUSH_EVENT_BASE_SCHEMA = GITHUB_EVENT_BASE_SCHEMA.extend({
37
- after: z.string(),
38
- before: z.string(),
39
- ref: z.string(),
40
- })
41
- const GITHUB_RELEASE_EVENT_BASE_SCHEMA = GITHUB_EVENT_BASE_SCHEMA.extend({
42
- action: z.string(),
43
- release: z.looseObject({ id: z.number(), tag_name: z.string() }),
44
- })
45
- const GITHUB_WORKFLOW_RUN_EVENT_BASE_SCHEMA = GITHUB_EVENT_BASE_SCHEMA.extend({
46
- action: z.string(),
47
- workflow_run: z.looseObject({
48
- conclusion: z.string().nullable(),
49
- id: z.number(),
50
- }),
51
- })
52
- const GITHUB_ISSUE_BASE_SCHEMA = z.looseObject({
53
- id: z.number(),
54
- number: z.number().int(),
55
- title: z.string(),
56
- })
57
- const GITHUB_PULL_REQUEST_BASE_SCHEMA = GITHUB_ISSUE_BASE_SCHEMA.extend({
58
- head: z.looseObject({ ref: z.string(), sha: z.string() }),
59
- })
60
- const GITHUB_ISSUE_COMMENT_BASE_SCHEMA = z.looseObject({
61
- body: z.string().nullable(),
62
- id: z.number(),
63
- })
64
- const GITHUB_PULL_REQUEST_REVIEW_BASE_SCHEMA = z.looseObject({
65
- id: z.number(),
66
- state: z.string(),
67
- })
68
-
69
- type GitHubWebhookPayload<TKey extends keyof webhooks> =
70
- webhooks[TKey]["post"] extends {
71
- requestBody: {
72
- content: { "application/json": infer TPayload }
73
- }
74
- }
75
- ? TPayload & Record<string, Encodable>
76
- : never
19
+ /** Complete issue response exposed by issue actions. */
20
+ export type GitHubIssue = GitHubRestResource<"issue">
21
+
22
+ /** Complete pull-request response exposed by pull-request actions. */
23
+ export type GitHubPullRequest = GitHubRestResource<"pull-request">
24
+
25
+ /** Pull-request list item exposed by list actions. */
26
+ export type GitHubPullRequestSummary =
27
+ GitHubRestResource<"pull-request-summary">
28
+
29
+ /** Complete issue-comment response exposed by comment actions. */
30
+ export type GitHubIssueComment = GitHubRestResource<"issue-comment">
31
+
32
+ /** Complete pull-request review response exposed by review actions. */
33
+ export type GitHubPullRequestReview = GitHubRestResource<"pull-request-review">
34
+
35
+ /** Pull-request merge response. */
36
+ export type GitHubPullRequestMerge = GitHubRestResource<"pull-request-merge">
77
37
 
78
38
  /** Official GitHub issue webhook payload union. */
79
39
  export type GitHubIssueEvent = GitHubWebhookPayload<
80
- Extract<keyof webhooks, `issues-${string}`>
40
+ Extract<GitHubWebhookOperation, `issues-${string}`>
81
41
  >
82
42
 
83
- /** Official GitHub pull request webhook payload union. */
84
- export type GitHubPullRequestEvent = GitHubWebhookPayload<
85
- Extract<keyof webhooks, `pull-request-${string}`>
43
+ export type GitHubIssueFieldAddedEvent =
44
+ GitHubWebhookPayload<"issues-field-added">
45
+ export type GitHubIssueFieldRemovedEvent =
46
+ GitHubWebhookPayload<"issues-field-removed">
47
+
48
+ /** Exact current pull-request family keys, excluding adjacent review families. */
49
+ type GitHubPullRequestWebhookOperation = Exclude<
50
+ Extract<GitHubWebhookOperation, `pull-request-${string}`>,
51
+ | "pull-request-review-dismissed"
52
+ | "pull-request-review-edited"
53
+ | "pull-request-review-submitted"
54
+ | `pull-request-review-comment-${string}`
55
+ | `pull-request-review-thread-${string}`
86
56
  >
87
57
 
58
+ /** Official GitHub pull request webhook payload union. */
59
+ export type GitHubPullRequestEvent =
60
+ GitHubWebhookPayload<GitHubPullRequestWebhookOperation>
61
+
62
+ export type GitHubPullRequestStackedEvent =
63
+ GitHubWebhookPayload<"pull-request-stacked">
64
+
88
65
  /** Official GitHub pull request review webhook payload union. */
89
66
  export type GitHubPullRequestReviewEvent = GitHubWebhookPayload<
90
- Extract<keyof webhooks, `pull-request-review-${string}`>
67
+ | "pull-request-review-dismissed"
68
+ | "pull-request-review-edited"
69
+ | "pull-request-review-submitted"
91
70
  >
92
71
 
93
72
  /** Official GitHub push webhook payload. */
@@ -95,35 +74,152 @@ export type GitHubPushEvent = GitHubWebhookPayload<"push">
95
74
 
96
75
  /** Official GitHub release webhook payload union. */
97
76
  export type GitHubReleaseEvent = GitHubWebhookPayload<
98
- Extract<keyof webhooks, `release-${string}`>
77
+ Extract<GitHubWebhookOperation, `release-${string}`>
99
78
  >
100
79
 
101
80
  /** Official GitHub workflow run webhook payload union. */
102
81
  export type GitHubWorkflowRunEvent = GitHubWebhookPayload<
103
- Extract<keyof webhooks, `workflow-run-${string}`>
82
+ Extract<GitHubWebhookOperation, `workflow-run-${string}`>
104
83
  >
105
84
 
106
85
  /** GitHub issue-opened webhook payload. */
107
86
  export type GitHubIssueOpenedEvent = GitHubWebhookPayload<"issues-opened">
108
87
 
88
+ /** GitHub issue-assigned webhook payload. */
89
+ export type GitHubIssueAssignedEvent = GitHubWebhookPayload<"issues-assigned">
90
+
109
91
  /** GitHub issue-reopened webhook payload. */
110
92
  export type GitHubIssueReopenedEvent = GitHubWebhookPayload<"issues-reopened">
111
93
 
112
94
  /** GitHub issue-closed webhook payload. */
113
95
  export type GitHubIssueClosedEvent = GitHubWebhookPayload<"issues-closed">
114
96
 
97
+ /** GitHub issue-deleted webhook payload. */
98
+ export type GitHubIssueDeletedEvent = GitHubWebhookPayload<"issues-deleted">
99
+
100
+ /** GitHub issue-demilestoned webhook payload. */
101
+ export type GitHubIssueDemilestonedEvent =
102
+ GitHubWebhookPayload<"issues-demilestoned">
103
+
104
+ /** GitHub issue-edited webhook payload. */
105
+ export type GitHubIssueEditedEvent = GitHubWebhookPayload<"issues-edited">
106
+
107
+ /** GitHub issue-labeled webhook payload. */
108
+ export type GitHubIssueLabeledEvent = GitHubWebhookPayload<"issues-labeled">
109
+
110
+ /** GitHub issue-locked webhook payload. */
111
+ export type GitHubIssueLockedEvent = GitHubWebhookPayload<"issues-locked">
112
+
113
+ /** GitHub issue-milestoned webhook payload. */
114
+ export type GitHubIssueMilestonedEvent =
115
+ GitHubWebhookPayload<"issues-milestoned">
116
+
117
+ /** GitHub issue-pinned webhook payload. */
118
+ export type GitHubIssuePinnedEvent = GitHubWebhookPayload<"issues-pinned">
119
+
120
+ /** GitHub issue-transferred webhook payload. */
121
+ export type GitHubIssueTransferredEvent =
122
+ GitHubWebhookPayload<"issues-transferred">
123
+
124
+ /** GitHub issue-typed webhook payload. */
125
+ export type GitHubIssueTypedEvent = GitHubWebhookPayload<"issues-typed">
126
+
127
+ /** GitHub issue-unassigned webhook payload. */
128
+ export type GitHubIssueUnassignedEvent =
129
+ GitHubWebhookPayload<"issues-unassigned">
130
+
131
+ /** GitHub issue-unlabeled webhook payload. */
132
+ export type GitHubIssueUnlabeledEvent = GitHubWebhookPayload<"issues-unlabeled">
133
+
134
+ /** GitHub issue-unlocked webhook payload. */
135
+ export type GitHubIssueUnlockedEvent = GitHubWebhookPayload<"issues-unlocked">
136
+
137
+ /** GitHub issue-unpinned webhook payload. */
138
+ export type GitHubIssueUnpinnedEvent = GitHubWebhookPayload<"issues-unpinned">
139
+
140
+ /** GitHub issue-untyped webhook payload. */
141
+ export type GitHubIssueUntypedEvent = GitHubWebhookPayload<"issues-untyped">
142
+
115
143
  /** GitHub pull-request-opened webhook payload. */
116
144
  export type GitHubPullRequestOpenedEvent =
117
145
  GitHubWebhookPayload<"pull-request-opened">
118
146
 
147
+ /** GitHub pull-request-assigned webhook payload. */
148
+ export type GitHubPullRequestAssignedEvent =
149
+ GitHubWebhookPayload<"pull-request-assigned">
150
+
151
+ /** GitHub pull-request-auto-merge-disabled webhook payload. */
152
+ export type GitHubPullRequestAutoMergeDisabledEvent =
153
+ GitHubWebhookPayload<"pull-request-auto-merge-disabled">
154
+
155
+ /** GitHub pull-request-auto-merge-enabled webhook payload. */
156
+ export type GitHubPullRequestAutoMergeEnabledEvent =
157
+ GitHubWebhookPayload<"pull-request-auto-merge-enabled">
158
+
159
+ /** GitHub pull-request-converted-to-draft webhook payload. */
160
+ export type GitHubPullRequestConvertedToDraftEvent =
161
+ GitHubWebhookPayload<"pull-request-converted-to-draft">
162
+
163
+ /** GitHub pull-request-demilestoned webhook payload. */
164
+ export type GitHubPullRequestDemilestonedEvent =
165
+ GitHubWebhookPayload<"pull-request-demilestoned">
166
+
167
+ /** GitHub pull-request-dequeued webhook payload. */
168
+ export type GitHubPullRequestDequeuedEvent =
169
+ GitHubWebhookPayload<"pull-request-dequeued">
170
+
171
+ /** GitHub pull-request-edited webhook payload. */
172
+ export type GitHubPullRequestEditedEvent =
173
+ GitHubWebhookPayload<"pull-request-edited">
174
+
175
+ /** GitHub pull-request-enqueued webhook payload. */
176
+ export type GitHubPullRequestEnqueuedEvent =
177
+ GitHubWebhookPayload<"pull-request-enqueued">
178
+
179
+ /** GitHub pull-request-labeled webhook payload. */
180
+ export type GitHubPullRequestLabeledEvent =
181
+ GitHubWebhookPayload<"pull-request-labeled">
182
+
183
+ /** GitHub pull-request-locked webhook payload. */
184
+ export type GitHubPullRequestLockedEvent =
185
+ GitHubWebhookPayload<"pull-request-locked">
186
+
187
+ /** GitHub pull-request-milestoned webhook payload. */
188
+ export type GitHubPullRequestMilestonedEvent =
189
+ GitHubWebhookPayload<"pull-request-milestoned">
190
+
119
191
  /** GitHub pull-request-ready-for-review webhook payload. */
120
192
  export type GitHubPullRequestReadyForReviewEvent =
121
193
  GitHubWebhookPayload<"pull-request-ready-for-review">
122
194
 
195
+ /** GitHub pull-request-reopened webhook payload. */
196
+ export type GitHubPullRequestReopenedEvent =
197
+ GitHubWebhookPayload<"pull-request-reopened">
198
+
199
+ /** GitHub pull-request-review-request-removed webhook payload. */
200
+ export type GitHubPullRequestReviewRequestRemovedEvent =
201
+ GitHubWebhookPayload<"pull-request-review-request-removed">
202
+
203
+ /** GitHub pull-request-review-requested webhook payload. */
204
+ export type GitHubPullRequestReviewRequestedEvent =
205
+ GitHubWebhookPayload<"pull-request-review-requested">
206
+
123
207
  /** GitHub pull-request-synchronize webhook payload. */
124
208
  export type GitHubPullRequestSynchronizedEvent =
125
209
  GitHubWebhookPayload<"pull-request-synchronize">
126
210
 
211
+ /** GitHub pull-request-unassigned webhook payload. */
212
+ export type GitHubPullRequestUnassignedEvent =
213
+ GitHubWebhookPayload<"pull-request-unassigned">
214
+
215
+ /** GitHub pull-request-unlabeled webhook payload. */
216
+ export type GitHubPullRequestUnlabeledEvent =
217
+ GitHubWebhookPayload<"pull-request-unlabeled">
218
+
219
+ /** GitHub pull-request-unlocked webhook payload. */
220
+ export type GitHubPullRequestUnlockedEvent =
221
+ GitHubWebhookPayload<"pull-request-unlocked">
222
+
127
223
  /** GitHub unmerged pull-request-closed webhook payload. */
128
224
  export type GitHubPullRequestClosedEvent =
129
225
  GitHubWebhookPayload<"pull-request-closed"> & {
@@ -164,6 +260,10 @@ export type GitHubPullRequestReviewChangesRequestedEvent =
164
260
  export type GitHubPullRequestReviewDismissedEvent =
165
261
  GitHubWebhookPayload<"pull-request-review-dismissed">
166
262
 
263
+ /** GitHub pull-request-review-edited webhook payload. */
264
+ export type GitHubPullRequestReviewEditedEvent =
265
+ GitHubWebhookPayload<"pull-request-review-edited">
266
+
167
267
  /** GitHub workflow-run-requested webhook payload. */
168
268
  export type GitHubWorkflowRunRequestedEvent =
169
269
  GitHubWebhookPayload<"workflow-run-requested">
@@ -199,87 +299,261 @@ export type GitHubWorkflowRunCancelledEvent =
199
299
  }
200
300
  }
201
301
 
302
+ /** Completed GitHub workflow run requiring action. */
303
+ export type GitHubWorkflowRunActionRequiredEvent =
304
+ GitHubWorkflowRunCompletedEvent & {
305
+ workflow_run: GitHubWorkflowRunCompletedEvent["workflow_run"] & {
306
+ conclusion: "action_required"
307
+ }
308
+ }
309
+
310
+ /** Completed GitHub workflow run with a neutral conclusion. */
311
+ export type GitHubWorkflowRunNeutralEvent = GitHubWorkflowRunCompletedEvent & {
312
+ workflow_run: GitHubWorkflowRunCompletedEvent["workflow_run"] & {
313
+ conclusion: "neutral"
314
+ }
315
+ }
316
+
317
+ /** Completed GitHub workflow run with a skipped conclusion. */
318
+ export type GitHubWorkflowRunSkippedEvent = GitHubWorkflowRunCompletedEvent & {
319
+ workflow_run: GitHubWorkflowRunCompletedEvent["workflow_run"] & {
320
+ conclusion: "skipped"
321
+ }
322
+ }
323
+
324
+ /** Completed GitHub workflow run with a stale conclusion. */
325
+ export type GitHubWorkflowRunStaleEvent = GitHubWorkflowRunCompletedEvent & {
326
+ workflow_run: GitHubWorkflowRunCompletedEvent["workflow_run"] & {
327
+ conclusion: "stale"
328
+ }
329
+ }
330
+
331
+ /** Completed GitHub workflow run that failed during startup. */
332
+ export type GitHubWorkflowRunStartupFailedEvent =
333
+ GitHubWorkflowRunCompletedEvent & {
334
+ workflow_run: GitHubWorkflowRunCompletedEvent["workflow_run"] & {
335
+ conclusion: "startup_failure"
336
+ }
337
+ }
338
+
339
+ /** Completed GitHub workflow run that timed out. */
340
+ export type GitHubWorkflowRunTimedOutEvent = GitHubWorkflowRunCompletedEvent & {
341
+ workflow_run: GitHubWorkflowRunCompletedEvent["workflow_run"] & {
342
+ conclusion: "timed_out"
343
+ }
344
+ }
345
+
202
346
  /** GitHub release-published webhook payload. */
203
347
  export type GitHubReleasePublishedEvent =
204
348
  GitHubWebhookPayload<"release-published">
205
349
 
206
- /** Octokit issue response kept aligned with the installed SDK version. */
207
- type GitHubIssue = Awaited<
208
- ReturnType<Octokit["rest"]["issues"]["get"]>
209
- >["data"] &
210
- Encodable
211
-
212
- /** Octokit pull request response kept aligned with the installed SDK version. */
213
- type GitHubPullRequest = Awaited<
214
- ReturnType<Octokit["rest"]["pulls"]["get"]>
215
- >["data"] &
216
- Encodable
217
-
218
- /** Octokit pull request list item kept aligned with the installed SDK version. */
219
- type GitHubPullRequestSummary = Awaited<
220
- ReturnType<Octokit["rest"]["pulls"]["list"]>
221
- >["data"][number] &
222
- Encodable
223
-
224
- /** Octokit issue comment response kept aligned with the installed SDK version. */
225
- type GitHubIssueComment = Awaited<
226
- ReturnType<Octokit["rest"]["issues"]["createComment"]>
227
- >["data"] &
228
- Encodable
229
-
230
- /**
231
- * Octokit pull request review response kept aligned with the installed SDK
232
- * version.
233
- */
234
- type GitHubPullRequestReview = Awaited<
235
- ReturnType<Octokit["rest"]["pulls"]["createReview"]>
236
- >["data"] &
237
- Encodable
238
-
239
- export const GITHUB_ISSUE_EVENT_SCHEMA: z.ZodType<GitHubIssueEvent> =
240
- z.custom<GitHubIssueEvent>(
241
- (value) => GITHUB_ISSUE_EVENT_BASE_SCHEMA.safeParse(value).success,
242
- )
243
- export const GITHUB_PULL_REQUEST_EVENT_SCHEMA: z.ZodType<GitHubPullRequestEvent> =
244
- z.custom<GitHubPullRequestEvent>(
245
- (value) => GITHUB_PULL_REQUEST_EVENT_BASE_SCHEMA.safeParse(value).success,
246
- )
247
- export const GITHUB_PULL_REQUEST_REVIEW_EVENT_SCHEMA: z.ZodType<GitHubPullRequestReviewEvent> =
248
- z.custom<GitHubPullRequestReviewEvent>(
249
- (value) =>
250
- GITHUB_PULL_REQUEST_REVIEW_EVENT_BASE_SCHEMA.safeParse(value).success,
251
- )
252
- export const GITHUB_PUSH_EVENT_SCHEMA: z.ZodType<GitHubPushEvent> =
253
- z.custom<GitHubPushEvent>(
254
- (value) => GITHUB_PUSH_EVENT_BASE_SCHEMA.safeParse(value).success,
255
- )
256
- export const GITHUB_RELEASE_EVENT_SCHEMA: z.ZodType<GitHubReleaseEvent> =
257
- z.custom<GitHubReleaseEvent>(
258
- (value) => GITHUB_RELEASE_EVENT_BASE_SCHEMA.safeParse(value).success,
259
- )
260
- export const GITHUB_WORKFLOW_RUN_EVENT_SCHEMA: z.ZodType<GitHubWorkflowRunEvent> =
261
- z.custom<GitHubWorkflowRunEvent>(
262
- (value) => GITHUB_WORKFLOW_RUN_EVENT_BASE_SCHEMA.safeParse(value).success,
263
- )
264
-
265
- export const GITHUB_ISSUE_OPENED_EVENT_SCHEMA = githubSemanticEventSchema<
266
- GitHubIssueEvent,
267
- GitHubIssueOpenedEvent
268
- >(GITHUB_ISSUE_EVENT_SCHEMA, (event) => event.action === "opened")
269
- export const GITHUB_ISSUE_REOPENED_EVENT_SCHEMA = githubSemanticEventSchema<
270
- GitHubIssueEvent,
271
- GitHubIssueReopenedEvent
272
- >(GITHUB_ISSUE_EVENT_SCHEMA, (event) => event.action === "reopened")
273
- export const GITHUB_ISSUE_CLOSED_EVENT_SCHEMA = githubSemanticEventSchema<
274
- GitHubIssueEvent,
275
- GitHubIssueClosedEvent
276
- >(GITHUB_ISSUE_EVENT_SCHEMA, (event) => event.action === "closed")
277
- export const GITHUB_PULL_REQUEST_OPENED_EVENT_SCHEMA =
350
+ /** GitHub release-created webhook payload. */
351
+ export type GitHubReleaseCreatedEvent = GitHubWebhookPayload<"release-created">
352
+
353
+ /** GitHub release-deleted webhook payload. */
354
+ export type GitHubReleaseDeletedEvent = GitHubWebhookPayload<"release-deleted">
355
+
356
+ /** GitHub release-edited webhook payload. */
357
+ export type GitHubReleaseEditedEvent = GitHubWebhookPayload<"release-edited">
358
+
359
+ /** GitHub release-prereleased webhook payload. */
360
+ export type GitHubReleasePrereleasedEvent =
361
+ GitHubWebhookPayload<"release-prereleased">
362
+
363
+ /** GitHub release-released webhook payload. */
364
+ export type GitHubReleaseReleasedEvent =
365
+ GitHubWebhookPayload<"release-released">
366
+
367
+ /** GitHub release-unpublished webhook payload. */
368
+ export type GitHubReleaseUnpublishedEvent =
369
+ GitHubWebhookPayload<"release-unpublished">
370
+
371
+ export const GITHUB_ISSUE_EVENT_SCHEMA: GitHubWebhookSchema<GitHubIssueEvent> =
372
+ githubWebhookEventSchema<GitHubIssueEvent>("issues")
373
+ export const GITHUB_PULL_REQUEST_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestEvent> =
374
+ githubWebhookEventSchema<GitHubPullRequestEvent>("pull_request")
375
+ export const GITHUB_PULL_REQUEST_REVIEW_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestReviewEvent> =
376
+ githubWebhookEventSchema<GitHubPullRequestReviewEvent>("pull_request_review")
377
+ export const GITHUB_PUSH_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPushEvent> =
378
+ githubWebhookEventSchema<GitHubPushEvent>("push")
379
+ export const GITHUB_RELEASE_EVENT_SCHEMA: GitHubWebhookSchema<GitHubReleaseEvent> =
380
+ githubWebhookEventSchema<GitHubReleaseEvent>("release")
381
+ export const GITHUB_WORKFLOW_RUN_EVENT_SCHEMA: GitHubWebhookSchema<GitHubWorkflowRunEvent> =
382
+ githubWebhookEventSchema<GitHubWorkflowRunEvent>("workflow_run")
383
+
384
+ export const GITHUB_ISSUE_OPENED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubIssueOpenedEvent> =
385
+ githubSemanticEventSchema<GitHubIssueEvent, GitHubIssueOpenedEvent>(
386
+ GITHUB_ISSUE_EVENT_SCHEMA,
387
+ (event) => event.action === "opened",
388
+ )
389
+ export const GITHUB_ISSUE_ASSIGNED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubIssueAssignedEvent> =
390
+ githubSemanticEventSchema<GitHubIssueEvent, GitHubIssueAssignedEvent>(
391
+ GITHUB_ISSUE_EVENT_SCHEMA,
392
+ (event) => event.action === "assigned",
393
+ )
394
+ export const GITHUB_ISSUE_REOPENED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubIssueReopenedEvent> =
395
+ githubSemanticEventSchema<GitHubIssueEvent, GitHubIssueReopenedEvent>(
396
+ GITHUB_ISSUE_EVENT_SCHEMA,
397
+ (event) => event.action === "reopened",
398
+ )
399
+ export const GITHUB_ISSUE_CLOSED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubIssueClosedEvent> =
400
+ githubSemanticEventSchema<GitHubIssueEvent, GitHubIssueClosedEvent>(
401
+ GITHUB_ISSUE_EVENT_SCHEMA,
402
+ (event) => event.action === "closed",
403
+ )
404
+ export const GITHUB_ISSUE_DELETED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubIssueDeletedEvent> =
405
+ githubSemanticEventSchema<GitHubIssueEvent, GitHubIssueDeletedEvent>(
406
+ GITHUB_ISSUE_EVENT_SCHEMA,
407
+ (event) => event.action === "deleted",
408
+ )
409
+ export const GITHUB_ISSUE_DEMILESTONED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubIssueDemilestonedEvent> =
410
+ githubSemanticEventSchema<GitHubIssueEvent, GitHubIssueDemilestonedEvent>(
411
+ GITHUB_ISSUE_EVENT_SCHEMA,
412
+ (event) => event.action === "demilestoned",
413
+ )
414
+ export const GITHUB_ISSUE_EDITED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubIssueEditedEvent> =
415
+ githubSemanticEventSchema<GitHubIssueEvent, GitHubIssueEditedEvent>(
416
+ GITHUB_ISSUE_EVENT_SCHEMA,
417
+ (event) => event.action === "edited",
418
+ )
419
+ export const GITHUB_ISSUE_FIELD_ADDED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubIssueFieldAddedEvent> =
420
+ githubSemanticEventSchema<GitHubIssueEvent, GitHubIssueFieldAddedEvent>(
421
+ GITHUB_ISSUE_EVENT_SCHEMA,
422
+ (event) => event.action === "field_added",
423
+ )
424
+ export const GITHUB_ISSUE_FIELD_REMOVED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubIssueFieldRemovedEvent> =
425
+ githubSemanticEventSchema<GitHubIssueEvent, GitHubIssueFieldRemovedEvent>(
426
+ GITHUB_ISSUE_EVENT_SCHEMA,
427
+ (event) => event.action === "field_removed",
428
+ )
429
+ export const GITHUB_ISSUE_LABELED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubIssueLabeledEvent> =
430
+ githubSemanticEventSchema<GitHubIssueEvent, GitHubIssueLabeledEvent>(
431
+ GITHUB_ISSUE_EVENT_SCHEMA,
432
+ (event) => event.action === "labeled",
433
+ )
434
+ export const GITHUB_ISSUE_LOCKED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubIssueLockedEvent> =
435
+ githubSemanticEventSchema<GitHubIssueEvent, GitHubIssueLockedEvent>(
436
+ GITHUB_ISSUE_EVENT_SCHEMA,
437
+ (event) => event.action === "locked",
438
+ )
439
+ export const GITHUB_ISSUE_MILESTONED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubIssueMilestonedEvent> =
440
+ githubSemanticEventSchema<GitHubIssueEvent, GitHubIssueMilestonedEvent>(
441
+ GITHUB_ISSUE_EVENT_SCHEMA,
442
+ (event) => event.action === "milestoned",
443
+ )
444
+ export const GITHUB_ISSUE_PINNED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubIssuePinnedEvent> =
445
+ githubSemanticEventSchema<GitHubIssueEvent, GitHubIssuePinnedEvent>(
446
+ GITHUB_ISSUE_EVENT_SCHEMA,
447
+ (event) => event.action === "pinned",
448
+ )
449
+ export const GITHUB_ISSUE_TRANSFERRED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubIssueTransferredEvent> =
450
+ githubSemanticEventSchema<GitHubIssueEvent, GitHubIssueTransferredEvent>(
451
+ GITHUB_ISSUE_EVENT_SCHEMA,
452
+ (event) => event.action === "transferred",
453
+ )
454
+ export const GITHUB_ISSUE_TYPED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubIssueTypedEvent> =
455
+ githubSemanticEventSchema<GitHubIssueEvent, GitHubIssueTypedEvent>(
456
+ GITHUB_ISSUE_EVENT_SCHEMA,
457
+ (event) => event.action === "typed",
458
+ )
459
+ export const GITHUB_ISSUE_UNASSIGNED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubIssueUnassignedEvent> =
460
+ githubSemanticEventSchema<GitHubIssueEvent, GitHubIssueUnassignedEvent>(
461
+ GITHUB_ISSUE_EVENT_SCHEMA,
462
+ (event) => event.action === "unassigned",
463
+ )
464
+ export const GITHUB_ISSUE_UNLABELED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubIssueUnlabeledEvent> =
465
+ githubSemanticEventSchema<GitHubIssueEvent, GitHubIssueUnlabeledEvent>(
466
+ GITHUB_ISSUE_EVENT_SCHEMA,
467
+ (event) => event.action === "unlabeled",
468
+ )
469
+ export const GITHUB_ISSUE_UNLOCKED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubIssueUnlockedEvent> =
470
+ githubSemanticEventSchema<GitHubIssueEvent, GitHubIssueUnlockedEvent>(
471
+ GITHUB_ISSUE_EVENT_SCHEMA,
472
+ (event) => event.action === "unlocked",
473
+ )
474
+ export const GITHUB_ISSUE_UNPINNED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubIssueUnpinnedEvent> =
475
+ githubSemanticEventSchema<GitHubIssueEvent, GitHubIssueUnpinnedEvent>(
476
+ GITHUB_ISSUE_EVENT_SCHEMA,
477
+ (event) => event.action === "unpinned",
478
+ )
479
+ export const GITHUB_ISSUE_UNTYPED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubIssueUntypedEvent> =
480
+ githubSemanticEventSchema<GitHubIssueEvent, GitHubIssueUntypedEvent>(
481
+ GITHUB_ISSUE_EVENT_SCHEMA,
482
+ (event) => event.action === "untyped",
483
+ )
484
+ export const GITHUB_PULL_REQUEST_ASSIGNED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestAssignedEvent> =
485
+ githubSemanticEventSchema<
486
+ GitHubPullRequestEvent,
487
+ GitHubPullRequestAssignedEvent
488
+ >(GITHUB_PULL_REQUEST_EVENT_SCHEMA, (event) => event.action === "assigned")
489
+ export const GITHUB_PULL_REQUEST_AUTO_MERGE_DISABLED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestAutoMergeDisabledEvent> =
490
+ githubSemanticEventSchema<
491
+ GitHubPullRequestEvent,
492
+ GitHubPullRequestAutoMergeDisabledEvent
493
+ >(
494
+ GITHUB_PULL_REQUEST_EVENT_SCHEMA,
495
+ (event) => event.action === "auto_merge_disabled",
496
+ )
497
+ export const GITHUB_PULL_REQUEST_AUTO_MERGE_ENABLED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestAutoMergeEnabledEvent> =
498
+ githubSemanticEventSchema<
499
+ GitHubPullRequestEvent,
500
+ GitHubPullRequestAutoMergeEnabledEvent
501
+ >(
502
+ GITHUB_PULL_REQUEST_EVENT_SCHEMA,
503
+ (event) => event.action === "auto_merge_enabled",
504
+ )
505
+ export const GITHUB_PULL_REQUEST_CONVERTED_TO_DRAFT_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestConvertedToDraftEvent> =
506
+ githubSemanticEventSchema<
507
+ GitHubPullRequestEvent,
508
+ GitHubPullRequestConvertedToDraftEvent
509
+ >(
510
+ GITHUB_PULL_REQUEST_EVENT_SCHEMA,
511
+ (event) => event.action === "converted_to_draft",
512
+ )
513
+ export const GITHUB_PULL_REQUEST_DEMILESTONED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestDemilestonedEvent> =
514
+ githubSemanticEventSchema<
515
+ GitHubPullRequestEvent,
516
+ GitHubPullRequestDemilestonedEvent
517
+ >(
518
+ GITHUB_PULL_REQUEST_EVENT_SCHEMA,
519
+ (event) => event.action === "demilestoned",
520
+ )
521
+ export const GITHUB_PULL_REQUEST_DEQUEUED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestDequeuedEvent> =
522
+ githubSemanticEventSchema<
523
+ GitHubPullRequestEvent,
524
+ GitHubPullRequestDequeuedEvent
525
+ >(GITHUB_PULL_REQUEST_EVENT_SCHEMA, (event) => event.action === "dequeued")
526
+ export const GITHUB_PULL_REQUEST_EDITED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestEditedEvent> =
527
+ githubSemanticEventSchema<
528
+ GitHubPullRequestEvent,
529
+ GitHubPullRequestEditedEvent
530
+ >(GITHUB_PULL_REQUEST_EVENT_SCHEMA, (event) => event.action === "edited")
531
+ export const GITHUB_PULL_REQUEST_ENQUEUED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestEnqueuedEvent> =
532
+ githubSemanticEventSchema<
533
+ GitHubPullRequestEvent,
534
+ GitHubPullRequestEnqueuedEvent
535
+ >(GITHUB_PULL_REQUEST_EVENT_SCHEMA, (event) => event.action === "enqueued")
536
+ export const GITHUB_PULL_REQUEST_LABELED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestLabeledEvent> =
537
+ githubSemanticEventSchema<
538
+ GitHubPullRequestEvent,
539
+ GitHubPullRequestLabeledEvent
540
+ >(GITHUB_PULL_REQUEST_EVENT_SCHEMA, (event) => event.action === "labeled")
541
+ export const GITHUB_PULL_REQUEST_LOCKED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestLockedEvent> =
542
+ githubSemanticEventSchema<
543
+ GitHubPullRequestEvent,
544
+ GitHubPullRequestLockedEvent
545
+ >(GITHUB_PULL_REQUEST_EVENT_SCHEMA, (event) => event.action === "locked")
546
+ export const GITHUB_PULL_REQUEST_MILESTONED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestMilestonedEvent> =
547
+ githubSemanticEventSchema<
548
+ GitHubPullRequestEvent,
549
+ GitHubPullRequestMilestonedEvent
550
+ >(GITHUB_PULL_REQUEST_EVENT_SCHEMA, (event) => event.action === "milestoned")
551
+ export const GITHUB_PULL_REQUEST_OPENED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestOpenedEvent> =
278
552
  githubSemanticEventSchema<
279
553
  GitHubPullRequestEvent,
280
554
  GitHubPullRequestOpenedEvent
281
555
  >(GITHUB_PULL_REQUEST_EVENT_SCHEMA, (event) => event.action === "opened")
282
- export const GITHUB_PULL_REQUEST_READY_FOR_REVIEW_EVENT_SCHEMA =
556
+ export const GITHUB_PULL_REQUEST_READY_FOR_REVIEW_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestReadyForReviewEvent> =
283
557
  githubSemanticEventSchema<
284
558
  GitHubPullRequestEvent,
285
559
  GitHubPullRequestReadyForReviewEvent
@@ -287,12 +561,53 @@ export const GITHUB_PULL_REQUEST_READY_FOR_REVIEW_EVENT_SCHEMA =
287
561
  GITHUB_PULL_REQUEST_EVENT_SCHEMA,
288
562
  (event) => event.action === "ready_for_review",
289
563
  )
290
- export const GITHUB_PULL_REQUEST_SYNCHRONIZED_EVENT_SCHEMA =
564
+ export const GITHUB_PULL_REQUEST_REOPENED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestReopenedEvent> =
565
+ githubSemanticEventSchema<
566
+ GitHubPullRequestEvent,
567
+ GitHubPullRequestReopenedEvent
568
+ >(GITHUB_PULL_REQUEST_EVENT_SCHEMA, (event) => event.action === "reopened")
569
+ export const GITHUB_PULL_REQUEST_REVIEW_REQUEST_REMOVED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestReviewRequestRemovedEvent> =
570
+ githubSemanticEventSchema<
571
+ GitHubPullRequestEvent,
572
+ GitHubPullRequestReviewRequestRemovedEvent
573
+ >(
574
+ GITHUB_PULL_REQUEST_EVENT_SCHEMA,
575
+ (event) => event.action === "review_request_removed",
576
+ )
577
+ export const GITHUB_PULL_REQUEST_REVIEW_REQUESTED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestReviewRequestedEvent> =
578
+ githubSemanticEventSchema<
579
+ GitHubPullRequestEvent,
580
+ GitHubPullRequestReviewRequestedEvent
581
+ >(
582
+ GITHUB_PULL_REQUEST_EVENT_SCHEMA,
583
+ (event) => event.action === "review_requested",
584
+ )
585
+ export const GITHUB_PULL_REQUEST_STACKED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestStackedEvent> =
586
+ githubSemanticEventSchema<
587
+ GitHubPullRequestEvent,
588
+ GitHubPullRequestStackedEvent
589
+ >(GITHUB_PULL_REQUEST_EVENT_SCHEMA, (event) => event.action === "stacked")
590
+ export const GITHUB_PULL_REQUEST_SYNCHRONIZED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestSynchronizedEvent> =
291
591
  githubSemanticEventSchema<
292
592
  GitHubPullRequestEvent,
293
593
  GitHubPullRequestSynchronizedEvent
294
594
  >(GITHUB_PULL_REQUEST_EVENT_SCHEMA, (event) => event.action === "synchronize")
295
- export const GITHUB_PULL_REQUEST_CLOSED_EVENT_SCHEMA =
595
+ export const GITHUB_PULL_REQUEST_UNASSIGNED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestUnassignedEvent> =
596
+ githubSemanticEventSchema<
597
+ GitHubPullRequestEvent,
598
+ GitHubPullRequestUnassignedEvent
599
+ >(GITHUB_PULL_REQUEST_EVENT_SCHEMA, (event) => event.action === "unassigned")
600
+ export const GITHUB_PULL_REQUEST_UNLABELED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestUnlabeledEvent> =
601
+ githubSemanticEventSchema<
602
+ GitHubPullRequestEvent,
603
+ GitHubPullRequestUnlabeledEvent
604
+ >(GITHUB_PULL_REQUEST_EVENT_SCHEMA, (event) => event.action === "unlabeled")
605
+ export const GITHUB_PULL_REQUEST_UNLOCKED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestUnlockedEvent> =
606
+ githubSemanticEventSchema<
607
+ GitHubPullRequestEvent,
608
+ GitHubPullRequestUnlockedEvent
609
+ >(GITHUB_PULL_REQUEST_EVENT_SCHEMA, (event) => event.action === "unlocked")
610
+ export const GITHUB_PULL_REQUEST_CLOSED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestClosedEvent> =
296
611
  githubSemanticEventSchema<
297
612
  GitHubPullRequestEvent,
298
613
  GitHubPullRequestClosedEvent
@@ -300,7 +615,7 @@ export const GITHUB_PULL_REQUEST_CLOSED_EVENT_SCHEMA =
300
615
  GITHUB_PULL_REQUEST_EVENT_SCHEMA,
301
616
  (event) => event.action === "closed" && !event.pull_request.merged,
302
617
  )
303
- export const GITHUB_PULL_REQUEST_MERGED_EVENT_SCHEMA =
618
+ export const GITHUB_PULL_REQUEST_MERGED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestMergedEvent> =
304
619
  githubSemanticEventSchema<
305
620
  GitHubPullRequestEvent,
306
621
  GitHubPullRequestMergedEvent
@@ -308,7 +623,7 @@ export const GITHUB_PULL_REQUEST_MERGED_EVENT_SCHEMA =
308
623
  GITHUB_PULL_REQUEST_EVENT_SCHEMA,
309
624
  (event) => event.action === "closed" && event.pull_request.merged,
310
625
  )
311
- export const GITHUB_PULL_REQUEST_REVIEW_SUBMITTED_EVENT_SCHEMA =
626
+ export const GITHUB_PULL_REQUEST_REVIEW_SUBMITTED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestReviewSubmittedEvent> =
312
627
  githubSemanticEventSchema<
313
628
  GitHubPullRequestReviewEvent,
314
629
  GitHubPullRequestReviewSubmittedEvent
@@ -316,7 +631,7 @@ export const GITHUB_PULL_REQUEST_REVIEW_SUBMITTED_EVENT_SCHEMA =
316
631
  GITHUB_PULL_REQUEST_REVIEW_EVENT_SCHEMA,
317
632
  (event) => event.action === "submitted",
318
633
  )
319
- export const GITHUB_PULL_REQUEST_REVIEW_APPROVED_EVENT_SCHEMA =
634
+ export const GITHUB_PULL_REQUEST_REVIEW_APPROVED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestReviewApprovedEvent> =
320
635
  githubSemanticEventSchema<
321
636
  GitHubPullRequestReviewEvent,
322
637
  GitHubPullRequestReviewApprovedEvent
@@ -325,7 +640,7 @@ export const GITHUB_PULL_REQUEST_REVIEW_APPROVED_EVENT_SCHEMA =
325
640
  (event) =>
326
641
  event.action === "submitted" && event.review.state === "approved",
327
642
  )
328
- export const GITHUB_PULL_REQUEST_REVIEW_CHANGES_REQUESTED_EVENT_SCHEMA =
643
+ export const GITHUB_PULL_REQUEST_REVIEW_CHANGES_REQUESTED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestReviewChangesRequestedEvent> =
329
644
  githubSemanticEventSchema<
330
645
  GitHubPullRequestReviewEvent,
331
646
  GitHubPullRequestReviewChangesRequestedEvent
@@ -335,7 +650,7 @@ export const GITHUB_PULL_REQUEST_REVIEW_CHANGES_REQUESTED_EVENT_SCHEMA =
335
650
  event.action === "submitted" &&
336
651
  event.review.state === "changes_requested",
337
652
  )
338
- export const GITHUB_PULL_REQUEST_REVIEW_DISMISSED_EVENT_SCHEMA =
653
+ export const GITHUB_PULL_REQUEST_REVIEW_DISMISSED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestReviewDismissedEvent> =
339
654
  githubSemanticEventSchema<
340
655
  GitHubPullRequestReviewEvent,
341
656
  GitHubPullRequestReviewDismissedEvent
@@ -343,22 +658,30 @@ export const GITHUB_PULL_REQUEST_REVIEW_DISMISSED_EVENT_SCHEMA =
343
658
  GITHUB_PULL_REQUEST_REVIEW_EVENT_SCHEMA,
344
659
  (event) => event.action === "dismissed",
345
660
  )
346
- export const GITHUB_WORKFLOW_RUN_REQUESTED_EVENT_SCHEMA =
661
+ export const GITHUB_PULL_REQUEST_REVIEW_EDITED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubPullRequestReviewEditedEvent> =
662
+ githubSemanticEventSchema<
663
+ GitHubPullRequestReviewEvent,
664
+ GitHubPullRequestReviewEditedEvent
665
+ >(
666
+ GITHUB_PULL_REQUEST_REVIEW_EVENT_SCHEMA,
667
+ (event) => event.action === "edited",
668
+ )
669
+ export const GITHUB_WORKFLOW_RUN_REQUESTED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubWorkflowRunRequestedEvent> =
347
670
  githubSemanticEventSchema<
348
671
  GitHubWorkflowRunEvent,
349
672
  GitHubWorkflowRunRequestedEvent
350
673
  >(GITHUB_WORKFLOW_RUN_EVENT_SCHEMA, (event) => event.action === "requested")
351
- export const GITHUB_WORKFLOW_RUN_STARTED_EVENT_SCHEMA =
674
+ export const GITHUB_WORKFLOW_RUN_STARTED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubWorkflowRunStartedEvent> =
352
675
  githubSemanticEventSchema<
353
676
  GitHubWorkflowRunEvent,
354
677
  GitHubWorkflowRunStartedEvent
355
678
  >(GITHUB_WORKFLOW_RUN_EVENT_SCHEMA, (event) => event.action === "in_progress")
356
- export const GITHUB_WORKFLOW_RUN_COMPLETED_EVENT_SCHEMA =
679
+ export const GITHUB_WORKFLOW_RUN_COMPLETED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubWorkflowRunCompletedEvent> =
357
680
  githubSemanticEventSchema<
358
681
  GitHubWorkflowRunEvent,
359
682
  GitHubWorkflowRunCompletedEvent
360
683
  >(GITHUB_WORKFLOW_RUN_EVENT_SCHEMA, (event) => event.action === "completed")
361
- export const GITHUB_WORKFLOW_RUN_SUCCEEDED_EVENT_SCHEMA =
684
+ export const GITHUB_WORKFLOW_RUN_SUCCEEDED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubWorkflowRunSucceededEvent> =
362
685
  githubSemanticEventSchema<
363
686
  GitHubWorkflowRunEvent,
364
687
  GitHubWorkflowRunSucceededEvent
@@ -368,7 +691,7 @@ export const GITHUB_WORKFLOW_RUN_SUCCEEDED_EVENT_SCHEMA =
368
691
  event.action === "completed" &&
369
692
  event.workflow_run.conclusion === "success",
370
693
  )
371
- export const GITHUB_WORKFLOW_RUN_FAILED_EVENT_SCHEMA =
694
+ export const GITHUB_WORKFLOW_RUN_FAILED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubWorkflowRunFailedEvent> =
372
695
  githubSemanticEventSchema<
373
696
  GitHubWorkflowRunEvent,
374
697
  GitHubWorkflowRunFailedEvent
@@ -378,7 +701,7 @@ export const GITHUB_WORKFLOW_RUN_FAILED_EVENT_SCHEMA =
378
701
  event.action === "completed" &&
379
702
  event.workflow_run.conclusion === "failure",
380
703
  )
381
- export const GITHUB_WORKFLOW_RUN_CANCELLED_EVENT_SCHEMA =
704
+ export const GITHUB_WORKFLOW_RUN_CANCELLED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubWorkflowRunCancelledEvent> =
382
705
  githubSemanticEventSchema<
383
706
  GitHubWorkflowRunEvent,
384
707
  GitHubWorkflowRunCancelledEvent
@@ -388,38 +711,113 @@ export const GITHUB_WORKFLOW_RUN_CANCELLED_EVENT_SCHEMA =
388
711
  event.action === "completed" &&
389
712
  event.workflow_run.conclusion === "cancelled",
390
713
  )
391
- export const GITHUB_RELEASE_PUBLISHED_EVENT_SCHEMA = githubSemanticEventSchema<
392
- GitHubReleaseEvent,
393
- GitHubReleasePublishedEvent
394
- >(GITHUB_RELEASE_EVENT_SCHEMA, (event) => event.action === "published")
395
-
396
- export const GITHUB_ISSUE_SCHEMA = z.custom<GitHubIssue>(
397
- (value) => GITHUB_ISSUE_BASE_SCHEMA.safeParse(value).success,
398
- )
399
- export const GITHUB_PULL_REQUEST_SCHEMA = z.custom<GitHubPullRequest>(
400
- (value) => GITHUB_PULL_REQUEST_BASE_SCHEMA.safeParse(value).success,
401
- )
402
- export const GITHUB_PULL_REQUEST_SUMMARY_SCHEMA =
403
- z.custom<GitHubPullRequestSummary>(
404
- (value) => GITHUB_PULL_REQUEST_BASE_SCHEMA.safeParse(value).success,
714
+ export const GITHUB_WORKFLOW_RUN_ACTION_REQUIRED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubWorkflowRunActionRequiredEvent> =
715
+ githubSemanticEventSchema<
716
+ GitHubWorkflowRunEvent,
717
+ GitHubWorkflowRunActionRequiredEvent
718
+ >(
719
+ GITHUB_WORKFLOW_RUN_EVENT_SCHEMA,
720
+ (event) =>
721
+ event.action === "completed" &&
722
+ event.workflow_run.conclusion === "action_required",
405
723
  )
406
- export const GITHUB_ISSUE_COMMENT_SCHEMA = z.custom<GitHubIssueComment>(
407
- (value) => GITHUB_ISSUE_COMMENT_BASE_SCHEMA.safeParse(value).success,
408
- )
409
- export const GITHUB_PULL_REQUEST_REVIEW_SCHEMA =
410
- z.custom<GitHubPullRequestReview>(
411
- (value) => GITHUB_PULL_REQUEST_REVIEW_BASE_SCHEMA.safeParse(value).success,
724
+ export const GITHUB_WORKFLOW_RUN_NEUTRAL_EVENT_SCHEMA: GitHubWebhookSchema<GitHubWorkflowRunNeutralEvent> =
725
+ githubSemanticEventSchema<
726
+ GitHubWorkflowRunEvent,
727
+ GitHubWorkflowRunNeutralEvent
728
+ >(
729
+ GITHUB_WORKFLOW_RUN_EVENT_SCHEMA,
730
+ (event) =>
731
+ event.action === "completed" &&
732
+ event.workflow_run.conclusion === "neutral",
733
+ )
734
+ export const GITHUB_WORKFLOW_RUN_SKIPPED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubWorkflowRunSkippedEvent> =
735
+ githubSemanticEventSchema<
736
+ GitHubWorkflowRunEvent,
737
+ GitHubWorkflowRunSkippedEvent
738
+ >(
739
+ GITHUB_WORKFLOW_RUN_EVENT_SCHEMA,
740
+ (event) =>
741
+ event.action === "completed" &&
742
+ event.workflow_run.conclusion === "skipped",
743
+ )
744
+ export const GITHUB_WORKFLOW_RUN_STALE_EVENT_SCHEMA: GitHubWebhookSchema<GitHubWorkflowRunStaleEvent> =
745
+ githubSemanticEventSchema<
746
+ GitHubWorkflowRunEvent,
747
+ GitHubWorkflowRunStaleEvent
748
+ >(
749
+ GITHUB_WORKFLOW_RUN_EVENT_SCHEMA,
750
+ (event) =>
751
+ event.action === "completed" && event.workflow_run.conclusion === "stale",
752
+ )
753
+ export const GITHUB_WORKFLOW_RUN_STARTUP_FAILED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubWorkflowRunStartupFailedEvent> =
754
+ githubSemanticEventSchema<
755
+ GitHubWorkflowRunEvent,
756
+ GitHubWorkflowRunStartupFailedEvent
757
+ >(
758
+ GITHUB_WORKFLOW_RUN_EVENT_SCHEMA,
759
+ (event) =>
760
+ event.action === "completed" &&
761
+ event.workflow_run.conclusion === "startup_failure",
762
+ )
763
+ export const GITHUB_WORKFLOW_RUN_TIMED_OUT_EVENT_SCHEMA: GitHubWebhookSchema<GitHubWorkflowRunTimedOutEvent> =
764
+ githubSemanticEventSchema<
765
+ GitHubWorkflowRunEvent,
766
+ GitHubWorkflowRunTimedOutEvent
767
+ >(
768
+ GITHUB_WORKFLOW_RUN_EVENT_SCHEMA,
769
+ (event) =>
770
+ event.action === "completed" &&
771
+ event.workflow_run.conclusion === "timed_out",
772
+ )
773
+ export const GITHUB_RELEASE_PUBLISHED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubReleasePublishedEvent> =
774
+ githubSemanticEventSchema<GitHubReleaseEvent, GitHubReleasePublishedEvent>(
775
+ GITHUB_RELEASE_EVENT_SCHEMA,
776
+ (event) => event.action === "published",
777
+ )
778
+ export const GITHUB_RELEASE_CREATED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubReleaseCreatedEvent> =
779
+ githubSemanticEventSchema<GitHubReleaseEvent, GitHubReleaseCreatedEvent>(
780
+ GITHUB_RELEASE_EVENT_SCHEMA,
781
+ (event) => event.action === "created",
782
+ )
783
+ export const GITHUB_RELEASE_DELETED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubReleaseDeletedEvent> =
784
+ githubSemanticEventSchema<GitHubReleaseEvent, GitHubReleaseDeletedEvent>(
785
+ GITHUB_RELEASE_EVENT_SCHEMA,
786
+ (event) => event.action === "deleted",
787
+ )
788
+ export const GITHUB_RELEASE_EDITED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubReleaseEditedEvent> =
789
+ githubSemanticEventSchema<GitHubReleaseEvent, GitHubReleaseEditedEvent>(
790
+ GITHUB_RELEASE_EVENT_SCHEMA,
791
+ (event) => event.action === "edited",
792
+ )
793
+ export const GITHUB_RELEASE_PRERELEASED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubReleasePrereleasedEvent> =
794
+ githubSemanticEventSchema<GitHubReleaseEvent, GitHubReleasePrereleasedEvent>(
795
+ GITHUB_RELEASE_EVENT_SCHEMA,
796
+ (event) => event.action === "prereleased",
797
+ )
798
+ export const GITHUB_RELEASE_RELEASED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubReleaseReleasedEvent> =
799
+ githubSemanticEventSchema<GitHubReleaseEvent, GitHubReleaseReleasedEvent>(
800
+ GITHUB_RELEASE_EVENT_SCHEMA,
801
+ (event) => event.action === "released",
802
+ )
803
+ export const GITHUB_RELEASE_UNPUBLISHED_EVENT_SCHEMA: GitHubWebhookSchema<GitHubReleaseUnpublishedEvent> =
804
+ githubSemanticEventSchema<GitHubReleaseEvent, GitHubReleaseUnpublishedEvent>(
805
+ GITHUB_RELEASE_EVENT_SCHEMA,
806
+ (event) => event.action === "unpublished",
412
807
  )
413
- export const GITHUB_PULL_REQUEST_MERGE_SCHEMA = z.object({
414
- /** Provider status text describing the merge result. */
415
- message: z.string(),
416
-
417
- /** Whether GitHub merged the pull request. */
418
- merged: z.boolean(),
419
808
 
420
- /** Merge commit SHA, when GitHub created one. */
421
- sha: z.string().nullable(),
422
- })
809
+ export const GITHUB_ISSUE_SCHEMA =
810
+ githubRestResourceSchema<GitHubIssue>("issue")
811
+ export const GITHUB_PULL_REQUEST_SCHEMA =
812
+ githubRestResourceSchema<GitHubPullRequest>("pull-request")
813
+ export const GITHUB_PULL_REQUEST_SUMMARY_SCHEMA =
814
+ githubRestResourceSchema<GitHubPullRequestSummary>("pull-request-summary")
815
+ export const GITHUB_ISSUE_COMMENT_SCHEMA =
816
+ githubRestResourceSchema<GitHubIssueComment>("issue-comment")
817
+ export const GITHUB_PULL_REQUEST_REVIEW_SCHEMA =
818
+ githubRestResourceSchema<GitHubPullRequestReview>("pull-request-review")
819
+ export const GITHUB_PULL_REQUEST_MERGE_SCHEMA =
820
+ githubRestResourceSchema<GitHubPullRequestMerge>("pull-request-merge")
423
821
 
424
822
  /**
425
823
  * Narrows a validated broad GitHub webhook family to one semantic event.
@@ -428,9 +826,9 @@ export const GITHUB_PULL_REQUEST_MERGE_SCHEMA = z.object({
428
826
  * @param matches - Semantic action or status classifier.
429
827
  */
430
828
  function githubSemanticEventSchema<TEvent, TSemanticEvent extends TEvent>(
431
- schema: z.ZodType<TEvent>,
829
+ schema: GitHubWebhookSchema<TEvent>,
432
830
  matches: (event: TEvent) => boolean,
433
- ): z.ZodType<TSemanticEvent> {
831
+ ): GitHubWebhookSchema<TSemanticEvent> {
434
832
  return z.custom<TSemanticEvent>((value) => {
435
833
  const event = schema.safeParse(value)
436
834
  return event.success && matches(event.data)