diff --git a/lib/push/setup.js b/lib/push/setup.js index 3789abb0..b2e1934f 100644 --- a/lib/push/setup.js +++ b/lib/push/setup.js @@ -33,7 +33,7 @@ async function setup({ toolkit, octokit, payload, sha }) { toolkit.info('"twitter-together-setup" branch created'); // Create tweets/README.md from same file in gr2m/twitter-together repo - // https://developer.github.com/v3/repos/contents/#create-a-file} + // https://developer.github.com/v3/repos/contents/#get-contents const { data: readmeContent } = await octokit.request( "GET /repos/:owner/:repo/contents/:path", { @@ -45,11 +45,12 @@ async function setup({ toolkit, octokit, payload, sha }) { path: "tweets/README.md" } ); + // https://developer.github.com/v3/repos/contents/#create-or-update-a-file await octokit.request("PUT /repos/:owner/:repo/contents/:path", { owner: payload.repository.owner.login, repo: payload.repository.name, path: "tweets/README.md", - content: readmeContent.toString("base64"), + content: Buffer.from(readmeContent).toString("base64"), branch: "twitter-together-setup", message: "twitter-together setup" });