Cloudflare Worker that handles GitHub App webhooks and OAuth flows for OpenClaw.
- Automatic Setup: When installed, automatically creates
.github/workflows/openclaw.ymland setsOPENCLAW_API_KEYsecret - Webhook Handling: Receives GitHub events (installation, issues, PRs, comments)
- OAuth Flow: Handles GitHub OAuth callback for user authentication
POST /webhook- GitHub webhook receiver (verifies signature)GET /auth/callback- OAuth callback handlerGET /health- Health check endpointGET /- Home page with endpoint documentation
npm installSet the following environment variables using Wrangler:
wrangler secret put GITHUB_APP_ID
wrangler secret put GITHUB_APP_PRIVATE_KEY
wrangler secret put GITHUB_CLIENT_ID
wrangler secret put GITHUB_CLIENT_SECRET
wrangler secret put GITHUB_WEBHOOK_SECRET
wrangler secret put OPENROUTER_API_KEYnpm run deploynpm run devsrc/
├── index.ts - Main router and entry point
├── webhook.ts - GitHub webhook handler
├── oauth.ts - OAuth flow handler
├── setup.ts - Auto-setup logic (workflow + secret)
└── types.ts - TypeScript types
- User installs the GitHub App on their account/org
- GitHub sends
installation.createdwebhook to/webhook - Worker verifies webhook signature
- For each repository:
- Creates
.github/workflows/openclaw.ymlworkflow file - Sets
OPENCLAW_API_KEYas a repository secret
- Creates
- Repository is now ready to use OpenClaw
The auto-created workflow listens for:
- Issue opens/edits
- Issue comments
- PR opens/edits/syncs
Events are forwarded to the OpenClaw API with authentication.
- Webhook signatures are verified using
GITHUB_WEBHOOK_SECRET - Repository secrets use placeholder values initially (must be updated)
- Secret encryption currently uses a placeholder implementation (
⚠️ TODO: implement proper libsodium encryption)
- Implement proper libsodium encryption for repository secrets
- Add installation settings UI
- Support custom workflow templates
- Add logging/monitoring integration
- Handle repository removal events
MIT