From a478a2b7c63ed65578045caadad6132621c4da03 Mon Sep 17 00:00:00 2001 From: babblebey Date: Wed, 28 Aug 2024 16:12:12 +0100 Subject: [PATCH] refactor: remove conditions from searchAPI fallback logic --- lib/find-sr-issues.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/find-sr-issues.js b/lib/find-sr-issues.js index 4a170d48..ca2b7756 100644 --- a/lib/find-sr-issues.js +++ b/lib/find-sr-issues.js @@ -19,17 +19,15 @@ export default async (octokit, title, labels, owner, repo) => { * BACKWARD COMPATIBILITY: Fallback to the search API if the issue was not found in the GraphQL response. * This fallback will be removed in a future release */ - if (issueNodes.length === 0) { - try { - const { - data: { items: backwardIssues }, - } = await octokit.request("GET /search/issues", { - q: `in:title+repo:${owner}/${repo}+type:issue+state:open+${title}`, - }); - issues.push(...backwardIssues); - } catch (error) { - console.log("Error: ", error); - } + try { + const { + data: { items: backwardIssues }, + } = await octokit.request("GET /search/issues", { + q: `in:title+repo:${owner}/${repo}+type:issue+state:open+${title}`, + }); + issues.push(...backwardIssues); + } catch (error) { + console.log("Error: ", error); } return issues.filter((issue) => issue.body && issue.body.includes(ISSUE_ID));