The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 06:00 UTC
| 1 | import * as Cloudflare from "@alchemy.run/cloudflare"; |
| 2 | import * as GitHub from "@alchemy.run/github"; |
| 3 | import * as Effect from "effect/Effect"; |
| 4 | import * as HttpServerResponse from "effect/http/HttpServerResponse"; |
| 5 | |
| 6 | export const owner = "alchemy-run-test"; |
| 7 | export const repository = "alchemy-pr-1932-event-source"; |
| 8 | |
| 9 | // Consumes the repository's events without passing a `secret`, so the |
| 10 | // event source has to generate one for the webhook and the Worker. |
| 11 | export default class GitHubEventSourceWorker extends Cloudflare.Worker<GitHubEventSourceWorker>()( |
| 12 | "GitHubEventSourceWorker", |
| 13 | { |
| 14 | main: import.meta.url, |
| 15 | }, |
| 16 | Effect.gen(function* () { |
| 17 | yield* GitHub.consumeRepositoryEvents({ owner, repository }, (event) => |
| 18 | Effect.log(`received ${event.name} (${event.id})`), |
| 19 | ); |
| 20 | |
| 21 | return { |
| 22 | fetch: Effect.succeed(HttpServerResponse.text("ok")), |
| 23 | }; |
| 24 | }).pipe(Effect.provide(GitHub.RepositoryEventSourceLive)), |
| 25 | ) {} |