Skip to content

Commit

Permalink
chore: update changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Anmol-Baranwal committed Nov 15, 2023
1 parent f6a4b9f commit 9076574
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
11 changes: 4 additions & 7 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ async function HandleMultipleIssues() {
const context = github.context;
core.notice("step 1.");
// Retrieve custom inputs
// const label = core.getInput("label") || "multiple issues"; // Set default label
// const labelInput = core.getInput("label");
const label = JSON.parse(core.getInput("label")) || ["multiple issues"];
// const labels = labelInput.split(",").map(label => label.trim());
const labels = core.getInput("label").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 @@ -83,8 +80,8 @@ async function HandleMultipleIssues() {
.map((issueNumber) => `#${issueNumber}`)
.join(", ");
// Check if label is an array and add multiple labels if needed
if (Array.isArray(label)) {
for (const lbl of label) {
if (Array.isArray(labels)) {
for (const lbl of labels) {
await octokit.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
Expand All @@ -99,7 +96,7 @@ async function HandleMultipleIssues() {
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumberToLabel,
labels: [label],
labels: [labels],
});
}
core.notice("Labels added to issue #" + issueNumberToLabel);
Expand Down
11 changes: 4 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ 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 label = JSON.parse(core.getInput("label")) || ["multiple issues"];
// const labels = labelInput.split(",").map(label => label.trim());
const labels = core.getInput("label").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 @@ -73,8 +70,8 @@ async function HandleMultipleIssues() {
.join(", ");

// Check if label is an array and add multiple labels if needed
if (Array.isArray(label)) {
for (const lbl of label) {
if (Array.isArray(labels)) {
for (const lbl of labels) {
await octokit.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
Expand All @@ -88,7 +85,7 @@ async function HandleMultipleIssues() {
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumberToLabel,
labels: [label],
labels: [labels],
});
}

Expand Down

0 comments on commit 9076574

Please sign in to comment.