Kind: Class
Source: atloria-monorepo/apps/api/src/git-sync/github-sync.adapter.ts
GithubSyncAdapter — the ONE place B1 talks to GitHub. Reads (refs, trees, blobs, compare) and writes (blobs → tree → commit → fast-forward ref update) via the existing GitHub App installation tokens, exactly like the freshness-PR GitHubWriteAdapter: hand-rolled REST over axios (no octokit in the repo), commits onto the CUSTOMER branch tip via the Git Data API — content, not history; NEVER a force update.
Methods
| Method | Signature | Returns |
|---|---|---|
tokenFor | tokenFor(repoFullName: string) | Promise<string> |
getBranchTip | getBranchTip(token: string, repoFullName: string, branch: string) | `Promise<RemoteTip |
commitExists | commitExists(token: string, repoFullName: string, sha: string) | Promise<boolean> |
compare | compare(token: string, repoFullName: string, base: string, head: string) | `Promise<{ status: string; files: RemoteChangedFile[] } |
getTreeRecursive | getTreeRecursive(token: string, repoFullName: string, treeSha: string) | Promise<RemoteTreeEntry[]> |
getFileAtRef | getFileAtRef(token: string, repoFullName: string, path: string, ref: string) | `Promise<string |
createBlob | createBlob(token: string, repoFullName: string, content: string) | Promise<string> |
createTree | createTree(token: string, repoFullName: string, baseTreeSha: string, entries: NewTreeEntry[]) | Promise<string> |
createCommit | createCommit(token: string, repoFullName: string, message: string, treeSha: string, parents: string[]) | Promise<string> |
updateRef | updateRef(token: string, repoFullName: string, branch: string, sha: string) | Promise<void> |
Where it refuses work
GithubSyncAdapterstops the work withSyncNotPermittedErrorwhenres.status === 403, in 2 places.GithubSyncAdapterstops the work withSyncNotPermittedErrorwhen!creds?.password.GithubSyncAdapterstops the work withErrorwhenres.data?.truncated === true.GithubSyncAdapterstops the work withErrorwhenres.status >= 400.GithubSyncAdapterstops the work with an early return whenres.status === 404, in 3 places.GithubSyncAdapterstops the work with an early return whenref.status === 404.
Referenced By
GitSyncIngestService(DEPENDS_ON)GitSyncModule(MODULE_PROVIDES)GitSyncMirrorService(DEPENDS_ON)
Was this page helpful?