Add GitHub worker for processing webhooks and fetching markdown files #8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add GitHub worker for processing webhooks and fetching markdown files
Summary
This PR introduces a new
github-workerpackage that processes GitHub webhooks to automatically fetch and store.mdand.mdxfiles from repositories. The worker implements:pushandpull_requestevents with HMAC-SHA256 signature verificationThe implementation follows existing monorepo patterns and integrates with the Cloudflare Workers ecosystem using wrangler configuration.
Review & Testing Checklist for Human
Recommended test plan: Deploy to a staging environment, configure webhooks on a test repository with various markdown files, trigger events, and verify data storage and retrieval.
Diagram
%%{ init : { "theme" : "default" }}%% graph TB GitHub["GitHub Repository<br/>(webhook source)"] --> Webhook["github-worker/src/webhook.ts<br/>Webhook Handler"]:::major-edit Webhook --> API["github-worker/src/github-api.ts<br/>GitHub API Client"]:::major-edit API --> Database["github-worker/src/database.ts<br/>Durable Object DB"]:::major-edit Index["github-worker/src/index.ts<br/>Main Worker"]:::major-edit --> Webhook Types["github-worker/src/types.ts<br/>Type Definitions"]:::major-edit --> Database Types --> API Types --> Webhook Config["github-worker/wrangler.toml<br/>Worker Configuration"]:::major-edit --> Index PackageRoot["package.json<br/>(root workspace)"]:::minor-edit --> PackageWorker["github-worker/package.json"]:::major-edit subgraph Legend L1[Major Edit]:::major-edit L2[Minor Edit]:::minor-edit L3[Context/No Edit]:::context end classDef major-edit fill:#90EE90 classDef minor-edit fill:#87CEEB classDef context fill:#FFFFFFNotes
anytypes in several places due to Cloudflare Workers type system complexity - this should be revisited for better type safetyGITHUB_WEBHOOK_SECRETenvironment variable matches your GitHub webhook configurationLink to Devin run: https://app.devin.ai/sessions/154eef22d18b4ecd9a571780c03094d8
Requested by: @nathanclevenger