From ee8c7b6aede00ef28c5ae7ee376256af64469aba Mon Sep 17 00:00:00 2001 From: Harrison Weinstock Date: Thu, 7 May 2026 22:45:22 +0000 Subject: [PATCH] fix: use search API with listForRepo fallback for issue dedup --- .github/workflows/ci-failure-issue.yml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-failure-issue.yml b/.github/workflows/ci-failure-issue.yml index 03997af4..2114154b 100644 --- a/.github/workflows/ci-failure-issue.yml +++ b/.github/workflows/ci-failure-issue.yml @@ -36,16 +36,27 @@ jobs: const branch = context.payload.workflow_run.head_branch; const title = `CI Failure: ${workflowName}`; - const { data: issues } = await github.rest.issues.listForRepo({ + const { data } = await github.rest.search.issuesAndPullRequests({ + q: `repo:${context.repo.owner}/${context.repo.repo} is:issue is:open in:title "${title}"` + }); + + if (data.items.some(i => i.title === title)) { + core.info(`Issue already exists for "${title}"`); + return; + } + + // Fallback: check recent issues in case search index is stale + const { data: recent } = await github.rest.issues.listForRepo({ owner: context.repo.owner, repo: context.repo.repo, - labels: 'high-severity,ci', state: 'open', - per_page: 100 + sort: 'created', + direction: 'desc', + per_page: 30 }); - if (issues.some(i => i.title === title)) { - core.info(`Issue already exists for "${title}"`); + if (recent.some(i => i.title === title)) { + core.info(`Issue already exists for "${title}" (found via fallback)`); return; }