CI & GitHub
Block PRs that break API contracts. Stoney runs checks against your preview deployment and posts results to GitHub.
Setup
1. Connect GitHub
Go to Settings → Connections → GitHub and authorize Stoney.
2. Configure preview URL
Tell Stoney where your PR previews deploy:
| Platform | Pattern |
|---|---|
| Vercel | https://{repo}-{branch}.vercel.app |
| Netlify | https://{branch}--{site}.netlify.app |
| Railway | Custom domain per branch |
| Custom | https://staging.yourapi.com |
Set this in Settings → Connections → Preview URL.
3. Enable CI protection
In the Contracts tab, toggle CI Protected on contracts you want to enforce.
How It Works
PR opened → Stoney receives webhook → Runs contracts against preview
→ Posts check result to GitHub
→ PR blocked if contracts failWhat gets tested
Only contracts marked as CI Protected run on PRs. These are typically:
- Stateless contracts — Auth checks (401 without token, 403 for wrong user)
- Validation contracts — Bad input returns 400
- Health checks —
/api/healthreturns 200
Shape contracts (learned from production) are not run in CI — they monitor production passively.
PR Check Results
Stoney posts a commit status to your PR:
✓ Stoney: 12 contracts passed
or
✗ Stoney: 1 contract failed
POST /api/ordersexpected 201, got 500
Click the details link to see full results in the Stoney dashboard.
Contract Tiers
| Tier | Runs in CI? | Description |
|---|---|---|
| Stateless | ✓ | No auth needed — tests error handling |
| Auth boundary | ✓ | Uses test tokens to verify permissions |
| Shape | ✗ | Passive production monitoring only |
| DB check | ✓ | SQL queries against your database |
Troubleshooting
PR checks not running?
- Verify GitHub is connected in Settings
- Check that the webhook is registered (Settings → Connections)
- Ensure at least one contract has CI Protected enabled
Checks failing unexpectedly?
- Confirm preview URL is correct
- Check if the preview deployment is ready when Stoney runs
- Review the run details in the dashboard
Want to skip CI for a PR?
Add [skip stoney] to your commit message.