Skip to content

Commit a8faccc

Browse files
committed
feat: remove desination column logic
1 parent 83146f2 commit a8faccc

1 file changed

Lines changed: 3 additions & 26 deletions

File tree

src/routes/webhooks/jira.post.ts

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ import { logger } from "../../lib/logger.js";
1313
* Secret: <JIRA_WEBHOOK_SECRET>
1414
* Events: Issue updated
1515
*
16-
* Auth strategy (checked in order):
17-
* 1. X-Hub-Signature HMAC-SHA256 (Jira signs the body when a secret is set)
18-
* 2. ?secret= query param (fallback — some Jira instances don't send the header)
16+
* Auth: X-Hub-Signature HMAC-SHA256 (Jira signs the body when a secret is set)
1917
*
20-
* The webhook fires immediately when a ticket is moved to the AI column,
18+
* The webhook fires immediately when a ticket changes,
2119
* eliminating the up-to-1-minute polling delay.
2220
*/
2321
export default defineEventHandler(async (event) => {
@@ -42,16 +40,7 @@ export default defineEventHandler(async (event) => {
4240
return { status: "ignored", reason: "wrong_project", ticketKey };
4341
}
4442

45-
const targetColumn = extractDestinationStatus(body);
46-
if (!targetColumn || targetColumn.toLowerCase() !== env.COLUMN_AI.toLowerCase()) {
47-
logger.debug(
48-
{ ticketKey, targetColumn, expectedColumn: env.COLUMN_AI },
49-
"webhook_ignored_not_ai_column",
50-
);
51-
return { status: "ignored", reason: "not_ai_column", ticketKey };
52-
}
53-
54-
logger.info({ ticketKey }, "webhook_received_ai_column_transition");
43+
logger.info({ ticketKey }, "webhook_received");
5544

5645
const adapters = createAdapters();
5746
const result = await dispatchTicket(ticketKey, adapters, env.MAX_CONCURRENT_AGENTS);
@@ -127,15 +116,3 @@ function extractProjectKey(body: any): string | null {
127116
return body?.issue?.fields?.project?.key ?? null;
128117
}
129118

130-
/**
131-
* Extract the destination status after a transition.
132-
*
133-
* Jira "issue_updated" webhooks include a `changelog.items` array.
134-
* When the status field changes, one item will have `field === "status"`
135-
* with `toString` being the new status name.
136-
*/
137-
function extractDestinationStatus(body: any): string | null {
138-
const items: any[] = body?.changelog?.items ?? [];
139-
const statusChange = items.find((item: any) => item.field === "status");
140-
return statusChange?.toString ?? null;
141-
}

0 commit comments

Comments
 (0)