Skip to content

Commit

Permalink
Remove labels instead of deleting (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalgn committed Jun 4, 2020
1 parent d8d7bba commit 4536e88
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions lib/merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,23 +97,20 @@ async function removeLabels(octokit, pullRequest, mergeRemoveLabels) {
return;
}

logger.debug(
"Removing labels:",
labels.map(label => label.name)
);
const labelNames = labels.map(label => label.name);

await Promise.all(
labels.map(label =>
octokit.issues.deleteLabel({
owner: pullRequest.base.repo.owner.login,
repo: pullRequest.base.repo.name,
issue_number: pullRequest.number,
name: label.name
})
)
);
logger.debug("Removing labels:", labelNames);

for (const name of labelNames) {
await octokit.issues.removeLabel({
owner: pullRequest.base.repo.owner.login,
repo: pullRequest.base.repo.name,
issue_number: pullRequest.number,
name
});
}

logger.info("Removed labels:", labels);
logger.info("Removed labels:", labelNames);
}

async function deleteBranch(octokit, pullRequest) {
Expand Down

0 comments on commit 4536e88

Please sign in to comment.