diff --git a/.github/prompts/similar_issues.prompt.yml b/.github/prompts/similar_issues.prompt.yml index d9c130a63..1c85493b2 100644 --- a/.github/prompts/similar_issues.prompt.yml +++ b/.github/prompts/similar_issues.prompt.yml @@ -6,13 +6,13 @@ messages: previously filed issues similar to the provided issue title and body. Use the GitHub tools via MCP to perform the search and retrieve real issue data (do not fabricate results). Consider semantic similarity across title and body. Exclude - the current issue. Return up to 3 of the most similar past issues. If none are + the current issue {{issue_number}}. Return up to 3 of the most similar past issues. If none are reasonably similar, return an empty list. Output must follow the response schema exactly and include only data you actually retrieved from GitHub tools. The current GitHub repository is: "{{repository}}". - role: user content: |- - Find similar issues for this new issue: + Find similar issues for issue {{issue_number}}: Title: {{issue_title}} Body: {{issue_body}} diff --git a/.github/workflows/similar-issues.yml b/.github/workflows/similar-issues.yml index 0d659ab51..0aa325d78 100644 --- a/.github/workflows/similar-issues.yml +++ b/.github/workflows/similar-issues.yml @@ -28,6 +28,7 @@ jobs: const bodyIndented = body.replace(/\n/g, '\n' + indent); core.setOutput('issue_title_json', JSON.stringify(title)); core.setOutput('issue_body_indented_json', JSON.stringify(bodyIndented)); + core.setOutput('issue_number', issue.number); - name: Find similar issues with AI (MCP) id: inference @@ -37,6 +38,7 @@ jobs: input: | issue_title: ${{ steps.prepare_input.outputs.issue_title_json }} issue_body: ${{ steps.prepare_input.outputs.issue_body_indented_json }} + issue_number: ${{ steps.prepare_input.outputs.issue_number }} repository: ${{ github.repository }} enable-github-mcp: true # Inference token can use GITHUB_TOKEN. MCP specifically requires a PAT. @@ -58,7 +60,7 @@ jobs: core.setOutput('has_matches', 'false'); return; } - const matches = Array.isArray(data.matches) ? data.matches : []; + const matches = Array.isArray(data.matches) ? data.matches.filter(m => m.number !== context.payload.issue.number) : []; if (!matches.length) { core.setOutput('has_matches', 'false'); return;