From 41a349ead50db256916f5506829e587d1ecb4a43 Mon Sep 17 00:00:00 2001 From: Karl-Philipp Wulfert Date: Thu, 17 Jan 2019 11:23:27 +0100 Subject: [PATCH] fix: unlabel issues with label meeting only --- src/tasks/unlabel.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/tasks/unlabel.ts b/src/tasks/unlabel.ts index 6dca6276..b0339263 100644 --- a/src/tasks/unlabel.ts +++ b/src/tasks/unlabel.ts @@ -35,12 +35,16 @@ export async function unlabel(api: Api) { logger.log('Fetched ' + issues.length + ' closed issue(s).'); await asyncPool(1, issues, async (issue) => { - await api.createNote( - issue.project_id, - issue.iid, - `${NOTE_PREFIX} Removed label \`meeting\` automatically. + if (issue.labels.indexOf('meeting') >= 0) { + logger.info(`Issue ${issue.title} is closed and has label "meeting". Removing it.`); + + await api.createNote( + issue.project_id, + issue.iid, + `${NOTE_PREFIX} Removed label \`meeting\` automatically. /unlabel ~meeting`, - ); + ); + } }); logger.ok('Label `meeting` has been removed from closed issues.');