Skip to content

Commit

Permalink
check changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Anmol-Baranwal committed Nov 15, 2023
1 parent 479366b commit f6a4b9f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
11 changes: 6 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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,
Expand All @@ -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);
Expand Down
11 changes: 6 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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,
Expand All @@ -87,7 +88,7 @@ async function HandleMultipleIssues() {
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumberToLabel,
labels: [labels],
labels: [label],
});
}

Expand Down

0 comments on commit f6a4b9f

Please sign in to comment.