diff --git a/dist/index.js b/dist/index.js index 49e3a6c..72b34d4 100644 --- a/dist/index.js +++ b/dist/index.js @@ -49,8 +49,9 @@ async function HandleMultipleIssues() { core.notice("step 1."); // Retrieve custom inputs // const label = core.getInput("label") || "multiple issues"; // Set default label - const labelInput = core.getInput("label"); - const labels = labelInput.split(",").map(label => label.trim()); + // const labelInput = core.getInput("label"); + const label = JSON.parse(core.getInput("label")) || ["multiple issues"]; + // const labels = labelInput.split(",").map(label => label.trim()); const assign = core.getInput("assign") === "true" || false; const issueNumber = core.getInput("issueNumber") === "true" || false; // converts to boolean const comment = core.getInput("comment"); @@ -82,8 +83,8 @@ async function HandleMultipleIssues() { .map((issueNumber) => `#${issueNumber}`) .join(", "); // Check if label is an array and add multiple labels if needed - if (Array.isArray(labels)) { - for (const lbl of labels) { + if (Array.isArray(label)) { + for (const lbl of label) { await octokit.rest.issues.addLabels({ owner: context.repo.owner, repo: context.repo.repo, @@ -98,7 +99,7 @@ async function HandleMultipleIssues() { owner: context.repo.owner, repo: context.repo.repo, issue_number: issueNumberToLabel, - labels: [labels], + labels: [label], }); } core.notice("Labels added to issue #" + issueNumberToLabel); diff --git a/src/index.ts b/src/index.ts index e043ece..87b3a0b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -22,8 +22,9 @@ async function HandleMultipleIssues() { // Retrieve custom inputs // const label = core.getInput("label") || "multiple issues"; // Set default label - const labelInput = core.getInput("label"); - const labels = labelInput.split(",").map(label => label.trim()); + // const labelInput = core.getInput("label"); + const label = JSON.parse(core.getInput("label")) || ["multiple issues"]; + // const labels = labelInput.split(",").map(label => label.trim()); const assign = core.getInput("assign") === "true" || false; const issueNumber = core.getInput("issueNumber") === "true" || false; // converts to boolean const comment = core.getInput("comment"); @@ -72,8 +73,8 @@ async function HandleMultipleIssues() { .join(", "); // Check if label is an array and add multiple labels if needed - if (Array.isArray(labels)) { - for (const lbl of labels) { + if (Array.isArray(label)) { + for (const lbl of label) { await octokit.rest.issues.addLabels({ owner: context.repo.owner, repo: context.repo.repo, @@ -87,7 +88,7 @@ async function HandleMultipleIssues() { owner: context.repo.owner, repo: context.repo.repo, issue_number: issueNumberToLabel, - labels: [labels], + labels: [label], }); }