Skip to content

Commit

Permalink
fix: validate presence of price label in issue before checking requir…
Browse files Browse the repository at this point in the history
…ements
  • Loading branch information
koya0 committed Jan 14, 2025
1 parent 86e316f commit 9b37967
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/handlers/shared/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ export async function start(
throw logger.error(`Skipping '/start' since there is no sender in the context.`);
}

const labels = issue.labels ?? [];
const priceLabel = labels.find((label: Label) => label.name.startsWith("Price: "));

if (!priceLabel) {
throw logger.error("No price label is set to calculate the duration", { issueNumber: issue.number });
}

await checkRequirements(context, issue, sender.login);

// is it a child issue?
Expand Down Expand Up @@ -158,13 +165,6 @@ ${issues}
return { content: error, status: HttpStatusCode.NOT_MODIFIED };
}

const labels = issue.labels ?? [];
const priceLabel = labels.find((label: Label) => label.name.startsWith("Price: "));

if (!priceLabel) {
throw logger.error("No price label is set to calculate the duration", { issueNumber: issue.number });
}

// Checks if non-collaborators can be assigned to the issue
for (const label of labels) {
if (label.description?.toLowerCase().includes("collaborator only")) {
Expand Down

0 comments on commit 9b37967

Please sign in to comment.