Fix lint automation workflow duplication and enhance issue titles with region context#59
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: BorDevTech <73800053+BorDevTech@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR resolves critical duplication issues in the lint automation system and enhances GitHub issue organization by adding region context to issue titles. The changes ensure lint analysis runs sequentially after Next.js deployment rather than simultaneously, preventing duplicate issue creation.
- Removed duplicate lint analysis from Next.js workflow to prevent race conditions
- Enhanced issue titles with region context for API verify files (e.g., "Arizona - logic.ts")
- Added workflow coordination using
workflow_runtriggers for proper sequencing
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| scripts/lint-automation/github-issue-creator.ts | Added region-aware title generation and backward compatibility for existing issues |
| .github/workflows/nextjs.yml | Removed duplicate lint analysis job to prevent issue duplication |
| .github/workflows/lint-automation.yml | Added workflow_run trigger to run after Next.js completion |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| title: fileName, | ||
| body: this.generateFileIssueBody(fileName, filePath, fileIssues), | ||
| title: enhancedTitle, | ||
| body: this.generateFileIssueBody(enhancedTitle, filePath, fileIssues), |
There was a problem hiding this comment.
The generateFileIssueBody method is being called with enhancedTitle as the first parameter, but this might not be the intended behavior. Based on the context, the first parameter should likely be the original fileName since the body generation might expect the actual filename rather than the enhanced display title.
| body: this.generateFileIssueBody(enhancedTitle, filePath, fileIssues), | |
| body: this.generateFileIssueBody(fileName, filePath, fileIssues), |
| const specialCases: Record<string, string> = { | ||
| 'districtofcolumbia': 'District of Columbia', | ||
| 'newhampshire': 'New Hampshire', | ||
| 'newjersey': 'New Jersey', | ||
| 'newmexico': 'New Mexico', | ||
| 'newyork': 'New York', | ||
| 'northcarolina': 'North Carolina', | ||
| 'northdakota': 'North Dakota', | ||
| 'rhodeisland': 'Rhode Island', | ||
| 'southcarolina': 'South Carolina', | ||
| 'southdakota': 'South Dakota', | ||
| 'westvirginia': 'West Virginia', | ||
| 'britishcolumbia': 'British Columbia', | ||
| 'newbrunswick': 'New Brunswick', | ||
| 'newfoundland&labrador': 'Newfoundland & Labrador', | ||
| 'novascotia': 'Nova Scotia', | ||
| 'princeedwardisland': 'Prince Edward Island', | ||
| 'puertorico': 'Puerto Rico' | ||
| }; |
There was a problem hiding this comment.
[nitpick] The hardcoded mapping of region names could be moved to a configuration file or constants module for better maintainability. This would make it easier to add new regions or modify existing ones without changing the core logic.
| } | ||
|
|
||
| // If no exact match found, try searching for just the filename part (for backward compatibility) | ||
| if (fileNamePart !== enhancedTitle) { |
There was a problem hiding this comment.
This condition could be optimized by checking if the enhanced title contains ' - ' before making the API call, since the fileNamePart extraction logic already handles this case. Consider moving this check earlier to avoid unnecessary API calls when the enhanced title doesn't have region context.
| if (fileNamePart !== enhancedTitle) { | |
| if (enhancedTitle.includes(' - ')) { |
This PR resolves critical issues with the lint automation system that were causing duplicate GitHub issues and poor issue organization.
Issues Fixed
1. Workflow Duplication
The lint automation was running in both
lint-automation.ymlandnextjs.ymlworkflows, creating duplicate GitHub issues for the same lint problems. This was particularly problematic when builds failed, as it would trigger lint analysis twice simultaneously.Before:
After:
2. Poor Issue Naming
GitHub issues were created with generic filenames like "logic.ts" or "route.ts", making it impossible to distinguish which region/state the issue belonged to.
Before:
After:
3. Improper Workflow Coordination
The lint automation was running simultaneously with the Next.js workflow instead of after it completed, causing race conditions and timing issues.
Technical Changes
Enhanced Title Generation
Added intelligent title generation that includes region context for API verify files while preserving simple names for other files:
The system handles special region name formatting (e.g., "districtofcolumbia" → "District of Columbia") and maintains backward compatibility with existing issues.
Workflow Orchestration
Updated the lint automation workflow to use
workflow_runtriggers, ensuring it runs automatically after the Next.js deployment completes:Race Condition Protection
Implemented safeguards to prevent duplicate issue creation:
Impact
This change significantly improves the developer experience when dealing with lint issues across the multi-region codebase.
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.