GitHub webhook β Lark notification integration. Receives GitHub webhooks on the console port and delivers Lark cards to console-configured routing destinations (group chats / DMs), plus DMs to PR reviewers.
This file is AGENTS.md; CLAUDE.md is a symlink to it β edit AGENTS.md.
app.rsβApp/Instance;build()requireswebhook_secretand threads theStateStoreintoAppState;routes()mounts the routing admin router;run()publishes liveAppStateinto thelark_kit::StateSlot.config.rsβGitHubConfig(secrets only) +AppState(github,bot,store).routes.rsβingress_router(slot):POST /webhook(mounted at/webhooks/github/).source/{handler.rs, utils.rs}βwebhook_handler(verify HMAC β octocrab parse β dispatch β deliver via routing) + theX-Hub-Signature-256verifier.cards.rsβ event βLarkCardbuilders.actions.rsβping,test-notify.
Routing lives in the shared lark_kit::routing module (reused by gitlab). The handler loads
the config fresh from the per-App StateStore (namespace = "github") on every webhook,
so console edits apply with no restart. The config β rules ({repo/org β chat/DM}), default
destinations, reviewer user_map, and alert_labels β is edited from the console's
GitHub tab (GET/PUT /api/apps/github/routing). Delivery is bot-only (group chat by
chat_id, DM by user open_id or email), so a lark_app must be bound for notifications to send.
POST /webhooks/github/webhook (HMAC X-Hub-Signature-256) β octocrab WebhookEvent β
build a LarkCard β deliver to cfg.destinations_for(repo, event) (subject = repo
full_name):
pull_requestβ opened / review-requested (+ reviewer DM viauser_map) / merged.issuesβ alert card when a label inalert_labelsis applied.workflow_runβ failed CI.secret_scanning/dependabotβ security alerts (critical/high). Card links come from the payload.
config.toml carries only secrets/bindings; routing is in the console (StateStore).
[github]: enabled, lark_app (binds a [lark-apps] for the bot), webhook_secret
(required; HMAC for X-Hub-Signature-256). Env overrides: GITHUB_WEBHOOK_SECRET, plus
LARK_* for the bot when not using lark_app.
cargo build -p github
cargo test -p github
cargo clippy -p github --all-targets -- -D warnings