@@ -304,6 +304,7 @@ jobs:
304304 echo "Finding all code files in repository..."
305305
306306 # Safely find code files with controlled patterns
307+ # Use a simpler approach to avoid complex piping issues
307308 find . -type f \( \
308309 -name "*.py" -o -name "*.js" -o -name "*.ts" -o -name "*.jsx" -o -name "*.tsx" -o \
309310 -name "*.java" -o -name "*.cpp" -o -name "*.c" -o -name "*.h" -o -name "*.go" -o \
@@ -319,11 +320,13 @@ jobs:
319320 -not -path "./__pycache__/*" \
320321 -not -path "./dist/*" \
321322 -not -path "./build/*" \
322- -not -path "./.github/*" \
323- -print0 | head -z -n "$MAX_FILES_PER_RUN" | tr '\0' '\n' | grep -v '^$' > code_files.txt
323+ -not -path "./.github/*" > all_files.txt
324+
325+ # Limit files and remove empty lines (reduce to 10 files to avoid argument length issues)
326+ head -n 10 all_files.txt | grep -v '^$' > code_files.txt || touch code_files.txt
324327
325328 file_count=$(wc -l < code_files.txt)
326- echo "Found $file_count code files (limited to $MAX_FILES_PER_RUN )"
329+ echo "Found $file_count code files (limited to 10 to avoid argument length issues )"
327330
328331 if [ "$file_count" -eq 0 ]; then
329332 echo "❌ No code files found in repository"
@@ -389,16 +392,20 @@ jobs:
389392 echo "" >> combined_prompt.txt
390393 cat "$PROMPT_FILE" >> combined_prompt.txt
391394
392- # Run Claude analysis with timeout
395+ # Run Claude analysis
393396 echo "Running Claude analysis on $file_count files..."
397+ echo "Prompt size: $(wc -c < combined_prompt.txt) characters"
394398
395- timeout 300 claude --model "$CLAUDE_MODEL" -p "$(cat combined_prompt.txt)" > "$OUTPUT_FILE" 2>&1 || {
396- echo "❌ Claude analysis failed or timed out"
399+ # Run Claude analysis (with limited files to avoid argument length issues)
400+ claude --model "$CLAUDE_MODEL" -p "$(cat combined_prompt.txt)" > "$OUTPUT_FILE" 2>&1 || {
401+ echo "❌ Claude analysis failed"
397402 echo "Troubleshooting:"
398403 echo "1. Check authentication: claude --version"
399404 echo "2. Check model availability: $CLAUDE_MODEL"
400405 echo "3. Check prompt size: wc -c combined_prompt.txt"
401406 echo "4. Check network connectivity"
407+ echo "5. Check error output:"
408+ [ -f "$OUTPUT_FILE" ] && cat "$OUTPUT_FILE"
402409 exit 1
403410 }
404411
@@ -414,7 +421,7 @@ jobs:
414421 chmod +x analyze_code.sh
415422
416423 - name : Run Code Review Analysis
417- if : steps.validate.outputs.task_type_validated == 'code-review ' || github.event_name != 'workflow_dispatch '
424+ if : github.event_name != 'workflow_dispatch ' || steps.validate.outputs.task_type_validated == 'code-review '
418425 env :
419426 CLAUDE_CODE_OAUTH_TOKEN : ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
420427 ANTHROPIC_API_KEY : ${{ secrets.ANTHROPIC_API_KEY }}
@@ -441,7 +448,20 @@ jobs:
441448 Be concise but thorough. Focus on actionable feedback.
442449 EOF
443450
451+ # Debug: Check if files exist
452+ echo "Debug: Checking prerequisites..."
453+ echo "- code_files.txt exists: $([ -f code_files.txt ] && echo 'YES' || echo 'NO')"
454+ echo "- analyze_code.sh exists: $([ -f analyze_code.sh ] && echo 'YES' || echo 'NO')"
455+ echo "- analysis_prompt.txt exists: $([ -f analysis_prompt.txt ] && echo 'YES' || echo 'NO')"
456+
457+ if [ -f code_files.txt ]; then
458+ echo "- Files to analyze: $(wc -l < code_files.txt)"
459+ echo "- File contents:"
460+ cat code_files.txt
461+ fi
462+
444463 # Run analysis using the secure function
464+ echo "Running analysis..."
445465 ./analyze_code.sh analysis_prompt.txt analysis_result.md
446466
447467 echo "✅ Code review analysis completed"
0 commit comments