diff --git a/src/github/validation/trigger.ts b/src/github/validation/trigger.ts index c16cdf1..e07482b 100644 --- a/src/github/validation/trigger.ts +++ b/src/github/validation/trigger.ts @@ -45,8 +45,21 @@ export function checkContainsTrigger(context: ParsedGitHubContext): boolean { } } - // Check for issue body and title trigger on issue creation + // Check for issue body, title, and label trigger on issue creation if (isIssuesEvent(context) && context.eventAction === "opened") { + // Check if the issue was created with the trigger label already applied + if (labelTrigger) { + const issueLabels: Array<{ name?: string }> = + (context.payload.issue as any).labels ?? []; + const hasLabel = issueLabels.some((l) => l.name === labelTrigger); + if (hasLabel) { + console.log( + `Issue opened with trigger label '${labelTrigger}' already applied`, + ); + return true; + } + } + const issueBody = context.payload.issue.body || ""; const issueTitle = context.payload.issue.title || ""; // Check for exact match with word boundaries or punctuation