fix: RemoveLabels when has no label (#88)

* fix: RemoveLabels when has no label

* doc
This commit is contained in:
xrkffgg
2021-09-06 19:17:30 +08:00
committed by GitHub
parent 8482b73885
commit ec5a128e11
13 changed files with 137 additions and 109 deletions

View File

@@ -289,8 +289,18 @@ async function doRemoveAssignees(owner, repo, issueNumber, assignees) {
}
async function doRemoveLabels(owner, repo, issueNumber, labels) {
const dealLabels = dealStringToArr(labels);
for (const label of dealLabels) {
const issue = await octokit.issues.get({
owner,
repo,
issue_number: issueNumber,
});
const baseLabels = issue.data.labels.map(({ name }) => name);
const removeLabels = baseLabels.filter(name => dealStringToArr(labels).includes(name));
core.info(`Actions: [filter-labels][${removeLabels.join(',')}] success!`);
for (const label of removeLabels) {
await octokit.issues.removeLabel({
owner,
repo,
@@ -299,6 +309,7 @@ async function doRemoveLabels(owner, repo, issueNumber, labels) {
});
core.info(`Actions: [remove-label][${label}] success!`);
}
core.info(`Actions: [remove-labels][${labels}] success!`);
}