WebHooker/docs/zh/guide/getting-started.md
wyf9 afe19795b1
docs: sync documentation with current codebase
- Update event formatter count 23 -> 28 (add ping, workflow_job, status, deployment, check_suite)
- Document Telegram support end-to-end (routes, /gh commands, richheader, secrets)
- Fix route schema to use targets array and group fields (owners, emoji)
- Correct KV/D1 storage layout (msg:*, i18n:*, D1 links/send_logs)
- Note GITHUB_APP_ID/GITHUB_PRIVATE_KEY are unused; drop legacy DISCORD_CHANNEL_ID/PORT/CONFIG_PATH
- Remove stale Docker deployment section
- Update color table, branch filter compatibility, admin API endpoints
- AGENTS.md: add Documentation section requiring doc updates after functional changes
2026-08-05 17:22:15 +08:00

2.3 KiB
Raw Blame History

快速开始

前置要求

安装

git clone https://github.com/ReCloudStudio/WebHooker.git
cd WebHooker
npm install

本地开发

1. 配置密钥

复制示例环境变量文件并填入你的密钥:

cp .env.example .dev.vars

编辑 .dev.vars,填入实际值:

GITHUB_WEBHOOK_SECRET=your-webhook-secret
GITHUB_CLIENT_ID=your-client-id
GITHUB_CLIENT_SECRET=your-client-secret
DISCORD_TOKEN=your-bot-token
DISCORD_PUBLIC_KEY=your-public-key
ADMIN_USER_IDS=your-github-id,your-github-login
BASE_URL=http://localhost:8787

::: tip GITHUB_APP_ID / GITHUB_PRIVATE_KEY 未被代码使用OAuth 流程只需要 Client ID/Secret可省略。目标频道在 Web UI 中按路由设置,因此不需要 DISCORD_CHANNEL_ID。若要在本地启用 /gh 命令,请在开发者门户复制 Public Key 填入 DISCORD_PUBLIC_KEY,并把 Interactions Endpoint URL 设为 http://localhost:8787/discord/interactions。 :::

::: warning .dev.vars 已被 gitignore包含敏感信息请勿提交。 :::

2. 启动开发服务器

npm run dev

这将在 http://localhost:8787 启动本地 Miniflare 环境。

3. 验证

curl http://localhost:8787/health
# → {"status":"ok"}

可用脚本

脚本 说明
npm run dev 启动本地开发服务器 (wrangler)
npm run deploy 部署到 Cloudflare
npm run typecheck TypeScript 类型检查
npm run lint ESLint
npm run lint:md Markdownlint
npm run format 使用 Prettier 格式化
npm run format:check 检查 Prettier 格式
npm run docs:dev 启动文档开发服务器
npm run docs:build 构建文档站点