8383 # Title length is now just a warning
8484 echo "title_length_valid=true" >> $GITHUB_OUTPUT
8585
86+ - name : ESLint Validation
87+ id : eslint-validation
88+ run : |
89+ echo "Running ESLint..."
90+
91+ # Check if ESLint script exists and run it
92+ if yarn run --help | grep -q "lint"; then
93+ echo "Found lint script, running ESLint..."
94+ if yarn lint; then
95+ echo "✅ ESLint passed"
96+ echo "eslint_valid=true" >> $GITHUB_OUTPUT
97+ else
98+ echo "❌ ESLint failed - code must pass linting to merge"
99+ echo "eslint_valid=false" >> $GITHUB_OUTPUT
100+ exit 1 # This will fail the job and block merge
101+ fi
102+ elif yarn run --help | grep -q "eslint"; then
103+ echo "Found eslint script, running ESLint..."
104+ if yarn eslint; then
105+ echo "✅ ESLint passed"
106+ echo "eslint_valid=true" >> $GITHUB_OUTPUT
107+ else
108+ echo "❌ ESLint failed - code must pass linting to merge"
109+ echo "eslint_valid=false" >> $GITHUB_OUTPUT
110+ exit 1 # This will fail the job and block merge
111+ fi
112+ else
113+ echo "⚠️ No ESLint script found - checking for eslint.config.js"
114+ if [ -f "eslint.config.js" ] || [ -f ".eslintrc.js" ] || [ -f ".eslintrc.json" ]; then
115+ echo "ESLint config found, running with npx..."
116+ if npx eslint . --ext .js,.jsx,.ts,.tsx; then
117+ echo "✅ ESLint passed"
118+ echo "eslint_valid=true" >> $GITHUB_OUTPUT
119+ else
120+ echo "❌ ESLint failed - code must pass linting to merge"
121+ echo "eslint_valid=false" >> $GITHUB_OUTPUT
122+ exit 1 # This will fail the job and block merge
123+ fi
124+ else
125+ echo "⚠️ No ESLint configuration found - skipping"
126+ echo "eslint_valid=true" >> $GITHUB_OUTPUT
127+ fi
128+ fi
129+
86130 - name : Test Coverage
87131 id : test-validation
88132 continue-on-error : true
@@ -116,11 +160,13 @@ jobs:
116160 script : |
117161 const branchName = '${{ github.head_ref }}';
118162 const prTitle = '${{ github.event.pull_request.title }}';
163+ const eslintValid = '${{ steps.eslint-validation.outputs.eslint_valid }}';
119164
120- // Simplified validation - everything passes by default
121- let status = '✅ **PASSED**';
165+ // Check if ESLint validation passed
166+ let status = eslintValid === 'true' ? '✅ **PASSED**' : '❌ **FAILED**';
167+ const eslintStatus = eslintValid === 'true' ? '✅ Pass' : '❌ Fail';
122168
123- // Generate simple report
169+ // Generate report with ESLint status
124170 let report = `## 🔍 PR Validation Report
125171
126172 **Status:** ${status}
@@ -129,10 +175,11 @@ jobs:
129175
130176 ---
131177
132- ### ✅ Validation Results
178+ ### Validation Results
133179
134180 | Check | Status | Description |
135181 |-------|--------|-------------|
182+ | **ESLint** | ${eslintStatus} | Code linting validation ${eslintValid === 'true' ? '(Required ✅)' : '(Required ❌)'} |
136183 | **Basic Validation** | ✅ Pass | PR structure validated |
137184 | **Branch Check** | ✅ Pass | Branch name accepted |
138185 | **Tests** | ✅ Pass | Tests completed |
@@ -141,7 +188,21 @@ jobs:
141188
142189 ### 🎯 Next Steps
143190
144- **This PR is ready for review** - all validation checks passed!
191+ ${eslintValid === 'true'
192+ ? '**This PR is ready for review** - all validation checks passed!'
193+ : '**❌ This PR cannot be merged** - ESLint validation failed. Please fix linting errors and push again.'
194+ }
195+
196+ ${eslintValid !== 'true'
197+ ? `
198+ **To fix ESLint errors:**
199+ 1. Run \`yarn lint\` locally to see all errors
200+ 2. Fix the linting issues in your code
201+ 3. Commit and push the fixes
202+ 4. The validation will run automatically again
203+ `
204+ : ''
205+ }
145206
146207 ---
147208
@@ -179,5 +240,9 @@ jobs:
179240 console.log('Could not post comment:', error.message);
180241 }
181242
182- // Always pass
183- core.info('✅ All PR validation checks passed - ready for review!');
243+ // Check if ESLint passed - fail if not
244+ if (eslintValid !== 'true') {
245+ core.setFailed('❌ PR validation failed: ESLint errors must be fixed before merge');
246+ } else {
247+ core.info('✅ All PR validation checks passed - ready for review!');
248+ }
0 commit comments