Skip to content

Sync Worker

Keeps the local database in sync with GitHub.

Queue: sync

Job Types

Job NameTriggerScope
full-syncStartup / manualAll installations
sync-installationApp installed/updatedOne installation
sync-repoNew repo webhookSingle repository

Sync Process

For each repository:

  1. Fetch metadataGET /repos/:owner/:repo → upsert repositories
  2. Fetch issuesGET /repos/:owner/:repo/issues?state=open → upsert issues
  3. Fetch PRsGET /repos/:owner/:repo/pulls?state=open → upsert pull_requests
  4. Fetch CI runsGET /repos/:owner/:repo/actions/runs?per_page=50 → upsert ci_runs
  5. Fetch collaboratorsGET /repos/:owner/:repo/collaborators → upsert repo_collaborators
  6. Fetch membersGET /orgs/:org/members → upsert members (org installations only)
  7. Fetch branch rulesGET /repos/:owner/:repo/branches → upsert branch_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.

Maintainer Worker

Released under the MIT License.