Sync Worker
Keeps the local database in sync with GitHub.
Queue: sync
Job Types
| Job Name | Trigger | Scope |
|---|---|---|
full-sync | Startup / manual | All installations |
sync-installation | App installed/updated | One installation |
sync-repo | New repo webhook | Single repository |
Sync Process
For each repository:
- Fetch metadata —
GET /repos/:owner/:repo→ upsertrepositories - Fetch issues —
GET /repos/:owner/:repo/issues?state=open→ upsertissues - Fetch PRs —
GET /repos/:owner/:repo/pulls?state=open→ upsertpull_requests - Fetch CI runs —
GET /repos/:owner/:repo/actions/runs?per_page=50→ upsertci_runs - Fetch collaborators —
GET /repos/:owner/:repo/collaborators→ upsertrepo_collaborators - Fetch members —
GET /orgs/:org/members→ upsertmembers(org installations only) - Fetch branch rules —
GET /repos/:owner/:repo/branches→ upsertbranch_rules
Error Handling
- Errors are always logged with
logger.warn()(never silently caught) - If one repo fails, the sync continues to the next
- Failed repos are recorded in the sync job metadata
Soft Deletes
When a repo is deleted on GitHub, the sync worker sets deleted_at on the repository record rather than deleting it. This preserves historical data.