From 9b2283fa01253899b1b35e8361bff3cab5ad4cfa Mon Sep 17 00:00:00 2001 From: lowlighter <22963968+lowlighter@users.noreply.github.com> Date: Mon, 26 Oct 2020 21:57:54 +0100 Subject: [PATCH] Use github.context.repo instead of username --- action/dist/index.js | 8 ++------ action/index.mjs | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/action/dist/index.js b/action/dist/index.js index a7843a01..9ab70173 100644 --- a/action/dist/index.js +++ b/action/dist/index.js @@ -926,17 +926,13 @@ var E_Users_lecoq_Documents_GitHub_gitstats_node_modules_actions_github_lib_gith //Retrieve previous render SHA to be able to update file content through API let sha = null try { - const {data} = await rest.repos.getContent({ - owner:user, - repo:user, - path:filename, - }) + const {data} = await rest.repos.getContent({owner:user, repo:github.context.repo, path:filename}) sha = data.sha } catch (error) { console.debug(error) } console.log(`Previous render sha | ${sha || "none"}`) //Update file content through API await rest.repos.createOrUpdateFileContents({ - owner:user, repo:user, path:filename, message:`Update ${filename} - [Skip GitHub Action]`, + owner:user, repo:github.context.repo, path:filename, message:`Update ${filename} - [Skip GitHub Action]`, content:Buffer.from(rendered).toString("base64"), ...(sha ? {sha} : {}) }) diff --git a/action/index.mjs b/action/index.mjs index 727d9f93..66a6ff37 100644 --- a/action/index.mjs +++ b/action/index.mjs @@ -132,17 +132,13 @@ //Retrieve previous render SHA to be able to update file content through API let sha = null try { - const {data} = await rest.repos.getContent({ - owner:user, - repo:user, - path:filename, - }) + const {data} = await rest.repos.getContent({owner:user, repo:github.context.repo, path:filename}) sha = data.sha } catch (error) { console.debug(error) } console.log(`Previous render sha | ${sha || "none"}`) //Update file content through API await rest.repos.createOrUpdateFileContents({ - owner:user, repo:user, path:filename, message:`Update ${filename} - [Skip GitHub Action]`, + owner:user, repo:github.context.repo, path:filename, message:`Update ${filename} - [Skip GitHub Action]`, content:Buffer.from(rendered).toString("base64"), ...(sha ? {sha} : {}) })