Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions .github/workflows/ci-failure-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"`
});
Comment thread
Hweinstock marked this conversation as resolved.

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;
}

Expand Down
Loading