Update index.js

This commit is contained in:
Benjamin Lannon 2018-12-05 21:33:00 -05:00
commit 345b170e18

View file

@ -18,7 +18,9 @@ async function run() {
console.log({ newLabels, labels });
let idxs = await Promise.all(
newLabels.forEach(async label => {
return new Promise(resolve => {
let { name, color, description } = label;
let idx = -1;
@ -38,8 +40,7 @@ async function run() {
});
console.log("UPDATE");
await octokit.issues.updateLabel(params);
labels.splice(idx, 1);
console.log("AFTER SPLICE", labels);
resolve(idx);
} else {
let params = tools.context.repo({
name,
@ -49,10 +50,15 @@ async function run() {
});
console.log("CREATE");
await octokit.issues.createLabel(params);
resolve(-1);
}
});
})
);
console.log(labels);
labels = labels.filter((_, idx) => {
return !idxs.includes(idx);
});
// Delete labels that exist on GitHub that aren't in labels.json
labels.forEach(async label => {