From 44dc9eca151c3fa30c3a00bdaefd706cb84825f1 Mon Sep 17 00:00:00 2001 From: Mason Williams <123421085+mason-at-pieces@users.noreply.github.com> Date: Thu, 18 Jan 2024 15:47:34 -0500 Subject: [PATCH 1/2] Added support for multi-select software --- .github/labeler/index.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/labeler/index.js b/.github/labeler/index.js index 9389cb9..066e51c 100644 --- a/.github/labeler/index.js +++ b/.github/labeler/index.js @@ -14,9 +14,17 @@ async function run() { const labels = []; - let software; - if (issueBodyLines[0] === '### Software') software = issueBodyLines[2].toLowerCase(); - if (software) labels.push(`app:${software}`); + // let software; + // if (issueBodyLines[0] === '### Software') software = issueBodyLines[2].toLowerCase(); + // if (software) labels.push(`app:${software}`); + + // Handle multiple software choices + if (issueBodyLines[0] === '### Software') { + const softwareChoices = issueBodyLines[2].split(',').map(s => s.trim().toLowerCase()); + softwareChoices.forEach(software => { + if (software) labels.push(`app:${software}`); + }); + } let os; if (issueBodyLines[4] === '### Operating System') os = issueBodyLines[6].toLowerCase(); @@ -30,4 +38,4 @@ async function run() { }); } -run().catch(err => console.error(err)); \ No newline at end of file +run().catch(err => console.error(err)); From 76c98ba7c179c40e829b61c2784db15ba5a1dfe2 Mon Sep 17 00:00:00 2001 From: Mason Williams <123421085+mason-at-pieces@users.noreply.github.com> Date: Thu, 18 Jan 2024 15:50:44 -0500 Subject: [PATCH 2/2] Removed trim and split by command and space --- .github/labeler/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/labeler/index.js b/.github/labeler/index.js index 066e51c..04e66b8 100644 --- a/.github/labeler/index.js +++ b/.github/labeler/index.js @@ -20,7 +20,7 @@ async function run() { // Handle multiple software choices if (issueBodyLines[0] === '### Software') { - const softwareChoices = issueBodyLines[2].split(',').map(s => s.trim().toLowerCase()); + const softwareChoices = issueBodyLines[2].split(', ').map(s => s.toLowerCase()); softwareChoices.forEach(software => { if (software) labels.push(`app:${software}`); });