From 51cc3a6906b7da952365442c93f0f528e80a3f91 Mon Sep 17 00:00:00 2001 From: Benjamin Lannon Date: Wed, 5 Dec 2018 20:16:14 -0500 Subject: [PATCH] Update index.js --- index.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index 6b57c7f..76fdd7f 100644 --- a/index.js +++ b/index.js @@ -14,21 +14,21 @@ async function run() { "labels.json" ); - let newLabels = fs.readFileSync(url).toJSON().data; + let newLabels = JSON.parse(fs.readFileSync(url).toString()); console.log({ newLabels }); - // newLabels.forEach(async label => { - // let { name, color, description } = label; + newLabels.forEach(async label => { + let { name, color, description } = label; - // let params = tools.context.repo({ name, color, description }); + let params = tools.context.repo({ name, color, description }); - // if (labels.some(issue => issue.name === name)) { - // await octokit.issues.updateLabel(params); - // } else { - // await octokit.issues.createLabel(params); - // } - // }); + if (labels.some(issue => issue.name === name)) { + await octokit.issues.updateLabel(params); + } else { + await octokit.issues.createLabel(params); + } + }); } run();