* 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,
)
| 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. |
no outgoing calls
no test coverage detected