# Deployment ## Cloudflare Setup ### 1. Create KV Namespace ```bash npx wrangler kv namespace create KV ``` This outputs a namespace ID. Update `wrangler.jsonc` with the ID: ```jsonc { "kv_namespaces": [ { "binding": "KV", "id": "your-namespace-id", }, ], } ``` ### 2. Set Secrets ```bash npx wrangler secret put GITHUB_WEBHOOK_SECRET npx wrangler secret put GITHUB_APP_ID npx wrangler secret put GITHUB_PRIVATE_KEY npx wrangler secret put GITHUB_CLIENT_ID npx wrangler secret put GITHUB_CLIENT_SECRET npx wrangler secret put DISCORD_TOKEN npx wrangler secret put DISCORD_CHANNEL_ID ``` ### 3. Deploy ```bash npx wrangler deploy ``` Your worker is now live at `https://webhooker..workers.dev`. ### 4. Configure GitHub Webhook 1. Go to your GitHub App settings 2. Set **Webhook URL** to `https://webhooker..workers.dev/webhook` 3. Set **Webhook secret** to match `GITHUB_WEBHOOK_SECRET` ## GitHub App Setup ### 1. Create App 1. Go to 2. Fill in: - **GitHub App name**: `WebHooker` (or your choice) - **Homepage URL**: your domain - **Webhook URL**: `https://your-domain/webhook` - **Webhook secret**: generate and copy to `GITHUB_WEBHOOK_SECRET` 3. Set permissions: - **Repository permissions**: Contents (read), Issues (write), Pull requests (write), Metadata (read) - **Organization permissions**: Members (read) — if needed 4. Subscribe to events (all 23 supported): - Push, Pull request, Issues, Issue comment, Workflow run, Release, Create, Delete, Star, Fork, Check run, Pull request review, Pull request review comment, Commit comment, Deployment status, Member, Label, Milestone, Discussion, Discussion comment, Repository, Code scanning alert, Dependabot alert 5. Generate private key → save contents to `GITHUB_PRIVATE_KEY` env var ### 2. Install App 1. After creation, go to the App settings page 2. Click "Install App" → select org/user 3. Choose repositories to monitor ### 3. Configure OAuth 1. Go to App → OAuth settings 2. Set **Callback URL**: `https://your-domain/auth/github/callback` 3. Copy Client ID and Client Secret to env ## Discord Bot Setup 1. Go to 2. Create a new application → go to Bot section 3. Copy the bot token to `DISCORD_TOKEN` 4. Invite the bot to your server with `bot` scope and `Send Messages` permission 5. Copy the target channel ID to `DISCORD_CHANNEL_ID` ## Custom Domain (Optional) To use a custom domain instead of `*.workers.dev`: 1. Go to your Cloudflare Worker settings 2. Add a custom domain or route 3. Update `BASE_URL` to match ## Docker A Dockerfile is provided for containerized deployments (e.g., behind a reverse proxy): ```bash docker build -t webhooker . docker run -p 8787:8787 --env-file .env webhooker ``` Note: Docker mode runs without Durable Objects and KV. Use Cloudflare deployment for full functionality.