revert: remove label check from opened events to prevent duplicates
Forgejo fires both issues/opened AND issues/label_updated when an issue is created with a label. Having the label check on opened caused duplicate Claude runs. Remove it — the label_updated event handles label triggers correctly now that the workflow gate and action normalization are fixed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
1feec26c2e
commit
3cd73bccde
1 file changed
+4
-14
@@ -45,21 +45,11 @@ export function checkContainsTrigger(context: ParsedGitHubContext): boolean {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for issue body, title, and label trigger on issue creation
|
// Check for issue body and title trigger on issue creation
|
||||||
|
// Note: label check is NOT done here — Forgejo fires a separate label_updated
|
||||||
|
// event even when a label is applied at creation time. Checking labels here
|
||||||
|
// would cause duplicate runs (both opened + labeled would match).
|
||||||
if (isIssuesEvent(context) && context.eventAction === "opened") {
|
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 issueBody = context.payload.issue.body || "";
|
||||||
const issueTitle = context.payload.issue.title || "";
|
const issueTitle = context.payload.issue.title || "";
|
||||||
// Check for exact match with word boundaries or punctuation
|
// Check for exact match with word boundaries or punctuation
|
||||||
|
|||||||
Reference in new issue
Block a user