GitHub App that scores pull requests for spam likelihood and posts a Coveralls-style commit status. PRs scoring ≥ 70% fail the check until a maintainer overrides.
Phase 3 status
- PR comment with score breakdown (upsert via
<!-- pr-spam-checker -->) - Repo-rules analyzer (issue refs, sections, forbidden phrases/paths)
- Comments on medium+ risk PRs (
warn_thresholdoralways_comment)
Phase 2 status
- Types, Zod config loader, weighted scorer
- Analyzers: reputation, description, diff, AI patterns
- Pipeline runs analyzers in parallel and posts tiered status
- Unit tests for scorer, description analyzer, and score thresholds
Phase 1 status
- Probot + TypeScript scaffold
-
pull_requestwebhook handler (opened,synchronize,reopened) - Pending → success commit status (
pr-spam-checker/status) - GitHub App registered and installed on a test repo
Quick start (local)
1. Install dependencies
npm install npm run build
2. Create a GitHub App
Option A — Probot setup (recommended for local dev)
npm run dev
Probot prints a URL to create and configure the app from app.yml. Follow the prompts.
Option B — Manual registration
- Go to github.com/settings/apps/new
- Set webhook URL to your tunnel endpoint +
/api/github/webhooks - Webhook secret: generate one and save it
- Permissions:
- Pull requests: Read & write
- Commit statuses: Read & write
- Contents: Read-only
- Issues: Read & write
- Metadata: Read-only
- Subscribe to events: Pull request, Issue comment
- Generate a private key and note the App ID
3. Configure environment
Copy .env.example to .env and fill in:
| Variable | Description |
|---|---|
APP_ID |
GitHub App ID |
PRIVATE_KEY |
PEM private key (use \n for newlines in .env) |
WEBHOOK_SECRET |
Webhook HMAC secret |
WEBHOOK_PROXY_URL |
Smee.io URL for local dev |
4. Forward webhooks locally
In a second terminal:
npx smee -u $WEBHOOK_PROXY_URL -t http://localhost:3000Or use Cloudflare Tunnel:
cloudflared tunnel --url http://localhost:3000
Paste the public URL into your GitHub App webhook settings as https://<host>/api/github/webhooks.
5. Install the app on a test repo
GitHub App settings → Install App → select a repository.
6. Verify
Open a pull request on the test repo. You should see:
- Pending —
PR Spam Check: analyzing... - Success —
PR Spam Check: passed (0%)
Branch protection (required to block merges in later phases)
Repo Settings → Branches → Add rule:
- Require status check:
pr-spam-checker/status
Scripts
| Command | Description |
|---|---|
npm run build |
Compile TypeScript to lib/ |
npm run dev |
Build and start Probot |
npm start |
Start Probot (requires prior build) |
npm test |
Run Vitest |
Project layout
src/
index.ts # Webhook handlers
pipeline.ts # Analysis orchestration
report/status.ts # Commit status posting
constants.ts # Shared constants
License
MIT