From 629a712af0155920ac5bf63080999a6904c77357 Mon Sep 17 00:00:00 2001 From: Gregor Martynus Date: Wed, 6 Nov 2019 14:19:55 -0800 Subject: [PATCH] fix: base64 encode README.md content --- lib/push/setup.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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" });