MCPcopy Index your code
hub / github.com/aircloud/sync-to-github / githubUpdateFile

Function githubUpdateFile

apps/chrome-ext/src/utils/githubSync.ts:42–64  ·  view source on GitHub ↗
(payload: SyncPayload)

Source from the content-addressed store, hash-verified

40}
41
42export const githubUpdateFile = async (payload: SyncPayload) => {
43 const octokit = new Octokit({
44 auth: payload.userConfig?.accessToken,
45 })
46
47 const fileName = payload.title
48 const filePath = `${payload.userConfig.pathPrefix}/${fileName}`
49
50 const currentFileInfo = await octokit.request('GET /repos/{owner}/{repo}/contents/{path}', {
51 owner: payload.userConfig.owner,
52 repo: payload.userConfig.repo,
53 path: filePath,
54 })
55
56 const { sha } = (currentFileInfo as { data: { sha: string } }).data
57
58 const res = await githubCreateFile({
59 ...payload,
60 sha,
61 })
62
63 return res
64}

Callers 1

syncFunction · 0.90

Calls 1

githubCreateFileFunction · 0.85

Tested by

no test coverage detected