From f0e2a21ecc00030e7a4d04ad46d552035aaa105d Mon Sep 17 00:00:00 2001 From: ishowvel Date: Thu, 24 Oct 2024 12:37:31 +0000 Subject: [PATCH] feat: remove unused higher time and priority labels --- src/handlers/pricing-label.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/handlers/pricing-label.ts b/src/handlers/pricing-label.ts index a68a890..1d6cff6 100644 --- a/src/handlers/pricing-label.ts +++ b/src/handlers/pricing-label.ts @@ -1,6 +1,6 @@ import { Context } from "../types/context"; -import { addLabelToIssue, clearAllPriceLabelsOnIssue, createLabel, listLabelsForRepo } from "../shared/label"; +import { addLabelToIssue, clearAllPriceLabelsOnIssue, createLabel, listLabelsForRepo, removeLabelFromIssue } from "../shared/label"; import { labelAccessPermissionsCheck } from "../shared/permissions"; import { setPrice } from "../shared/pricing"; import { Label, UserType } from "../types/github"; @@ -80,6 +80,18 @@ async function setPriceLabel(context: Context, issueLabels: Label[], config: Ass return; } + for (const timeLabel of recognizedLabels.time) { + if (timeLabel.name !== minLabels.time?.name) { + await removeLabelFromIssue(context, timeLabel.name); + } + } + + for (const priorityLabel of recognizedLabels.priority) { + if (priorityLabel.name !== minLabels.time?.name) { + await removeLabelFromIssue(context, priorityLabel.name); + } + } + const targetPriceLabel = setPrice(context, minLabels.time, minLabels.priority); if (targetPriceLabel) {