Skip to content

Fix filter logic to support both old and new body formats in issue detection#49

Merged
BorDevTech merged 3 commits into
mainfrom
copilot/fix-48
Sep 22, 2025
Merged

Fix filter logic to support both old and new body formats in issue detection#49
BorDevTech merged 3 commits into
mainfrom
copilot/fix-48

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Sep 22, 2025

The checkExistingRuleIssue method was only checking for the old body format when filtering existing GitHub issues, potentially missing issues that use the new format.

Problem

The filter logic in github-issue-creator.ts assumed the old body format with **Rule:** \${ruleId}`but the new format uses## 🔧 ${ruleId}`. This could cause the system to miss existing issues that use the new format when searching with rule-based queries, potentially leading to duplicate issue creation.

Solution

Updated the filter condition to check for both formats:

const ruleIssues = data.items.filter((issue: any) => 
  issue.title.includes(ruleId) ||
  issue.body.includes(`**Rule:** \`${ruleId}\``) ||     // Old format
  issue.body.includes(`## 🔧 ${ruleId}`)               // New format
);

This ensures backward compatibility while supporting the current implementation format.

Testing

  • ✅ All existing lint automation workflows continue to work
  • ✅ TypeScript compilation and ESLint validation pass
  • ✅ Verified both old and new formats are detected correctly
  • ✅ No regressions in existing functionality

Fixes #48.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel
Copy link
Copy Markdown

vercel Bot commented Sep 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
clear-view Ready Ready Preview Comment Sep 22, 2025 4:14am

Co-authored-by: BorDevTech <73800053+BorDevTech@users.noreply.github.com>
Co-authored-by: BorDevTech <73800053+BorDevTech@users.noreply.github.com>
Copilot AI changed the title [WIP] The filter logic assumes the old body format with **Rule:** \${ruleId}\` but the new format uses ## 🔧 ${ruleId}`. This could miss existing issues that use the new format when searching with the old rule-based queries. Fix filter logic to support both old and new body formats in issue detection Sep 22, 2025
Copilot AI requested a review from BorDevTech September 22, 2025 04:14
@BorDevTech BorDevTech marked this pull request as ready for review September 22, 2025 04:19
Copilot AI review requested due to automatic review settings September 22, 2025 04:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the GitHub issue detection logic to support both old and new body formats when searching for existing issues, preventing potential duplicate issue creation.

  • Updated filter logic in checkExistingRuleIssue method to check for both old (**Rule:** \${ruleId}`) and new (## 🔧 ${ruleId}`) body formats
  • Maintains backward compatibility while supporting the current implementation format
  • Ensures proper detection of existing issues regardless of format used

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@BorDevTech BorDevTech merged commit a9109f8 into main Sep 22, 2025
2 checks passed
@BorDevTech BorDevTech deleted the copilot/fix-48 branch September 22, 2025 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants