REVETOOL connects to GitHub at two levels: workspace OAuth (to sync PRs and issues) and per-project webhook (to receive real-time updates when PRs open or update).
Step 1 — Workspace OAuth
- Open
Workspace settings→Connectors. - Click
Connect GitHub. - Review scopes on GitHub consent screen.
- Click
Authorize. - You are redirected back. REVETOOL stores your encrypted token.
Required scopes
repo + read:user. Repo lets us fetch PRs, issues, file contents. User lets us identify the connecting account.Step 2 — Link a repo to a project
OAuth alone is not enough. You also link specific repos to specific projects.
- Open your project →
Connectors. - In the GitHub section, click
Link a repo. - Pick from your authorized repos.
- Click
Link. REVETOOL stores the mapping inproject_github_repos(M:N relation).
Step 3 — Set up the webhook
For real-time PR sync (and auto-staging-screens), you need to install a webhook on each linked repo.
- On the linked repo card, click
Setup webhook. - REVETOOL displays the webhook URL + the HMAC secret (1 secret per project for isolation).
- Copy both to GitHub repo → Settings → Webhooks → Add webhook.
- Set Content-Type to
application/json. - Subscribe to events:
pull_request,pull_request_review. - Save. GitHub will send a ping event to verify.
What happens when a PR opens
- GitHub sends webhook to
/api/github/webhook/[projectId]. - REVETOOL verifies HMAC signature.
- Extracts
[US-XX]pattern from PR title. - Finds the matching ticket in the project.
- For each concept linked to that ticket, creates a staging screen with
env_kind=staging+ labelPR #N. - If Vercel PAT is also connected, fetches the preview URL and sets it on the staging screen.
Step 4 — Import existing issues as backlog
On a linked repo card, click Import issues. REVETOOL fetches open issues (skipping PRs via the pull_request property) and creates backlog tickets.
- GitHub labels → backlog type/priority (mapping configurable per project).
- UPSERT batch idempotent on (project_id, title) — re-import is safe.
- Linked issue URL stored so you can jump back to GitHub.
AI code context
When you run AI analysis with the Code flag enabled, REVETOOL fetches code context from your linked repo.
- Extract keywords from the screen path (basename + parents).
- Search GitHub for files matching those keywords.
- Score each file (weighted match).
- Pick top 3 files, truncate to 200 lines / 5KB each.
- Inject into AI prompt as code context.
Privacy
Troubleshooting
Webhook signature invalid
Most likely a secret mismatch. Re-generate the webhook in REVETOOL settings, update on GitHub side. The HMAC secret is per-project for isolation — workspace A's secret won't match project B's endpoint.
PR opened but no staging screen created
Check the PR title — it must contain [US-XX] or similar pattern matching a ticket. Also check that the ticket is linked to at least one concept with at least one variant.