MCPcopy Create free account
hub / github.com/CodeFox-Repo/codefox / pushFileContent

Method pushFileContent

backend/src/github/github.service.ts:200–230  ·  view source on GitHub ↗

* Push a single file to the given path in the repo using GitHub Contents API. * * @param relativePathInRepo e.g. "backend/index.js" or "frontend/package.json"

(
    installationToken: string,
    owner: string,
    repo: string,
    localFilePath: string,
    relativePathInRepo: string,
    commitMessage: string,
  )

Source from the content-addressed store, hash-verified

198// * @param relativePathInRepo e.g. "backend/index.js" or "frontend/package.json"
199// */
200// async pushFileContent(
201// installationToken: string,
202// owner: string,
203// repo: string,
204// localFilePath: string,
205// relativePathInRepo: string,
206// commitMessage: string,
207// ) {
208// const fileBuffer = fs.readFileSync(localFilePath);
209// const base64Content = fileBuffer.toString('base64');
210
211// const url = `https://api.github.com/repos/${owner}/${repo}/contents/${relativePathInRepo}`;
212
213// await axios.put(
214// url,
215// {
216// message: commitMessage,
217// content: base64Content,
218// },
219// {
220// headers: {
221// Authorization: `token ${installationToken}`,
222// Accept: 'application/vnd.github.v3+json',
223// },
224// },
225// );
226
227// this.logger.log(
228// `Pushed file: ${relativePathInRepo} -> https://github.com/${owner}/${repo}`,
229// );
230// }
231
232// /**
233// * Recursively push all files in a local folder to the repo.

Callers 2

pushMultipleFilesMethod · 0.95
pushFolderContentMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected