mirror of
https://github.com/lannonbr/issue-label-manager-action.git
synced 2025-06-28 06:24:13 +00:00
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 });
|
console.log({ newLabels, labels });
|
||||||
|
|
||||||
|
let idxs = await Promise.all(
|
||||||
newLabels.forEach(async label => {
|
newLabels.forEach(async label => {
|
||||||
|
return new Promise(resolve => {
|
||||||
let { name, color, description } = label;
|
let { name, color, description } = label;
|
||||||
|
|
||||||
let idx = -1;
|
let idx = -1;
|
||||||
|
@ -38,8 +40,7 @@ async function run() {
|
||||||
});
|
});
|
||||||
console.log("UPDATE");
|
console.log("UPDATE");
|
||||||
await octokit.issues.updateLabel(params);
|
await octokit.issues.updateLabel(params);
|
||||||
labels.splice(idx, 1);
|
resolve(idx);
|
||||||
console.log("AFTER SPLICE", labels);
|
|
||||||
} else {
|
} else {
|
||||||
let params = tools.context.repo({
|
let params = tools.context.repo({
|
||||||
name,
|
name,
|
||||||
|
@ -49,10 +50,15 @@ async function run() {
|
||||||
});
|
});
|
||||||
console.log("CREATE");
|
console.log("CREATE");
|
||||||
await octokit.issues.createLabel(params);
|
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
|
// Delete labels that exist on GitHub that aren't in labels.json
|
||||||
labels.forEach(async label => {
|
labels.forEach(async label => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue