Skip to content

快速开始

前置要求

安装

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

本地开发

1. 配置密钥

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

bash
cp .env.example .dev.vars

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

bash
GITHUB_WEBHOOK_SECRET=your-webhook-secret
GITHUB_APP_ID=your-app-id
GITHUB_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----"
GITHUB_CLIENT_ID=your-client-id
GITHUB_CLIENT_SECRET=your-client-secret
DISCORD_TOKEN=your-bot-token
DISCORD_CHANNEL_ID=your-channel-id
BASE_URL=http://localhost:8787

WARNING

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

2. 启动开发服务器

bash
npm run dev

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

3. 验证

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

可用脚本

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

基于 MIT 许可发布。