Skip to content

Commit

Permalink
Correct some errors and update the logging
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwDayDream committed Jun 17, 2024
1 parent f8929d8 commit e18e063
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,24 @@ const github = require('@actions/github');
});

for (const label of copyLabels.data) {
if (label.name.match(regexFilter) === null) continue;

const newName = nameFormat.replace("${name}", label.name);
const curLabelIdx = currentLabels.data.findIndex(lbl => lbl.name == label.name);
if (curLabelIdx >= 0) {
const existing = currentLabels.data[curLabelIdx];
core.warning(`Overwriting label ${existing.name}...`)
await octokit.rest.issues.deleteLabel({
owner: destOwner, repo: destRepoName, name: currentLabels.data[curLabelIdx].name
owner: destOwner, repo: destRepoName, name: existing.name
});
}

await github.rest.issues.createLabel({
await octokit.rest.issues.createLabel({
owner: destOwner, repo: destRepoName,
name: label.name,
name: newName,
color: label.color,
description: label.description
});
core.info(`Created label ${newName} @ ${destRepo}`)
}
})();

0 comments on commit e18e063

Please sign in to comment.