Canvas: Generate Github nodes out of the dodo-app config
Change-Id: Ifc5b09deb39352a3025f7ea66ce39b421daac94d
diff --git a/apps/canvas/config/src/github.ts b/apps/canvas/config/src/github.ts
new file mode 100644
index 0000000..4040487
--- /dev/null
+++ b/apps/canvas/config/src/github.ts
@@ -0,0 +1,35 @@
+import { z } from "zod";
+
+export const GithubRepositorySchema = z.object({
+ id: z.number(),
+ name: z.string(),
+ full_name: z.string(),
+ html_url: z.string(),
+ ssh_url: z.string(),
+});
+
+export const GithubRepositoriesSchema = z.array(GithubRepositorySchema);
+
+export const DeployKeysSchema = z.array(
+ z.object({
+ id: z.number(),
+ key: z.string(),
+ }),
+);
+
+export const WebhookSchema = z.object({
+ id: z.number(),
+ config: z.object({
+ url: z.string().optional(), // url might not always be present
+ content_type: z.string().optional(),
+ }),
+ events: z.array(z.string()),
+ active: z.boolean(),
+});
+
+export const ListWebhooksResponseSchema = z.array(WebhookSchema);
+export type DeployKeys = z.infer<typeof DeployKeysSchema>;
+export type Webhook = z.infer<typeof WebhookSchema>;
+export type ListWebhooksResponse = z.infer<typeof ListWebhooksResponseSchema>;
+export type GithubRepository = z.infer<typeof GithubRepositorySchema>;
+export type GithubRepositories = z.infer<typeof GithubRepositoriesSchema>;