Skip to content

Sync Engine

How GitWire keeps your GitHub data fresh in the local database.

Sync Types

Job NameTriggerScope
full-syncManual / startupAll installations, all repos
sync-installationApp installed/updatedOne installation, all repos
sync-repoNew repo webhookSingle repository

What Gets Synced

For each repository:

DataGitHub APILocal Table
Repository metadataGET /repos/:owner/:reporepositories
Open issuesGET /repos/:owner/:repo/issuesissues
Open pull requestsGET /repos/:owner/:repo/pullspull_requests
Recent CI runsGET /repos/:owner/:repo/actions/runsci_runs
Org membersGET /orgs/:org/membersmembers
CollaboratorsGET /repos/:owner/:repo/collaboratorsrepo_collaborators
Branch rulesGET /repos/:owner/:repo/branchesbranch_rules

Sync Flow

mermaid
graph TD
    A[Sync Job] --> B[List Installations]
    B --> C[For Each Installation]
    C --> D[List Repositories]
    D --> E[For Each Repo]
    E --> F[Fetch Issues]
    E --> G[Fetch PRs]
    E --> H[Fetch CI Runs]
    E --> I[Fetch Collaborators]
    F --> J[Upsert into DB]
    G --> J
    H --> J
    I --> J

Triggering a Sync

bash
# Sync a specific repo
curl -X POST https://gitwire.yourdomain.com/api/repos/owner/repo/sync \
  -H "Authorization: Bearer YOUR_API_KEY"

Error Handling

Sync errors are always logged (never silently caught). If a single repo fails, the sync continues to the next repo. Failed items are logged with:

  • Repository name
  • API endpoint
  • HTTP status code
  • Error message

Worker Reference

See Sync Worker for implementation details.

Branch Enforcement

Released under the MIT License.