From bfa4b64f07d7003db5b7842ef1ced86b84d0abbe Mon Sep 17 00:00:00 2001 From: adela Date: Fri, 11 Oct 2024 11:08:05 +0800 Subject: [PATCH] hard code the transition id for In Progress --- .../src/app/api/update-jira-issue/route.ts | 35 ++----------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/jira-webhook/src/app/api/update-jira-issue/route.ts b/jira-webhook/src/app/api/update-jira-issue/route.ts index 4316dc4..1262d48 100644 --- a/jira-webhook/src/app/api/update-jira-issue/route.ts +++ b/jira-webhook/src/app/api/update-jira-issue/route.ts @@ -43,38 +43,7 @@ export async function POST(request: Request) { }, { status: updateResponse.status }); } - // Fetch available transitions - const transitionsResponse = await fetch(jiraTransitionUrl, { - method: 'GET', - headers: { - 'Accept': 'application/json', - 'Authorization': `Basic ${jiraAuth}`, - }, - }); - - if (!transitionsResponse.ok) { - return Response.json({ - error: 'Failed to fetch transitions', - status: transitionsResponse.status, - statusText: transitionsResponse.statusText, - }, { status: transitionsResponse.status }); - } - - const transitions = await transitionsResponse.json(); - console.log("Available transitions:", transitions); - - // Find the "In Progress" transition - const inProgressTransition = transitions.transitions.find( - (t: any) => t.name === "In Progress" - ); - - console.log("=============inProgressTransition", inProgressTransition) - - if (!inProgressTransition) { - return Response.json({ error: 'In Progress transition not found' }, { status: 400 }); - } - - // Then, transition the issue to "In Progress" + // Transition the issue to "In Progress" using the known transition ID const transitionResponse = await fetch(jiraTransitionUrl, { method: 'POST', headers: { @@ -84,7 +53,7 @@ export async function POST(request: Request) { }, body: JSON.stringify({ transition: { - id: inProgressTransition.id + id: "21" // Hardcoded "In Progress" transition ID } }), });