Merge pull request #3 from lowlighter/feat-bot-token

Fix wrong token use
This commit is contained in:
Simon Lecoq
2020-10-09 14:09:02 +02:00
committed by GitHub
2 changed files with 19 additions and 16 deletions

File diff suppressed because one or more lines are too long

View File

@@ -29,7 +29,7 @@
if (!token)
throw new Error("You must provide a valid GitHub token")
const graphql = octokit.graphql.defaults({headers:{authorization: `token ${token}`}})
const rest = github.getOctokit(committer)
const rest = github.getOctokit(token)
//Debug mode
if (!debug)
@@ -54,6 +54,8 @@
console.log(`Render | complete`)
//Commit to repository
{
const rest = github.getOctokit(committer)
let sha = undefined
try {
const {data} = await rest.repos.getContent({
@@ -69,6 +71,7 @@
content:Buffer.from(rendered).toString("base64"),
})
console.log(`Commit to repo | ok`)
}
//Success
console.log(`Success !`)