Update index.js
This commit is contained in:
parent
3ef25d9bb0
commit
345b170e18
1 changed files with 35 additions and 29 deletions
12
index.js
12
index.js
|
@ -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 => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue