Skip to content

Commit

Permalink
refactor: remove conditions from searchAPI fallback logic
Browse files Browse the repository at this point in the history
  • Loading branch information
babblebey committed Aug 28, 2024
1 parent 9189ccf commit a478a2b
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions lib/find-sr-issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit a478a2b

Please sign in to comment.