🔧 Fix nekocode analysis path and error handling
- Change analysis path from src/ to . (root) - Improve error handling without || true - Better regex patterns for result extraction - Add language count detection - Japanese error messages for clarity Fixes: 分析されたファイル 0 → 90+ files
This commit is contained in:
45
.github/workflows/nekocode-pr-analysis.yml
vendored
45
.github/workflows/nekocode-pr-analysis.yml
vendored
@ -30,41 +30,54 @@ jobs:
|
|||||||
id: analyze-pr
|
id: analyze-pr
|
||||||
run: |
|
run: |
|
||||||
echo "🔍 Analyzing PR changes..."
|
echo "🔍 Analyzing PR changes..."
|
||||||
./bin/nekocode-rust analyze src/ --stats-only > pr_analysis.txt 2>&1 || true
|
|
||||||
|
# 🎯 修正1: パスを. (ルート)に変更
|
||||||
|
./bin/nekocode-rust analyze . --stats-only > pr_analysis.txt 2>&1
|
||||||
|
|
||||||
|
# 🎯 修正2: エラー処理を改善
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "❌ NekoCode analysis failed!"
|
||||||
|
cat pr_analysis.txt
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "📊 Analysis Results:"
|
echo "📊 Analysis Results:"
|
||||||
cat pr_analysis.txt
|
cat pr_analysis.txt
|
||||||
|
|
||||||
FILES_COUNT=$(grep -o "found [0-9]* files" pr_analysis.txt | grep -o "[0-9]*" || echo "0")
|
# 🎯 修正3: より確実な値抽出
|
||||||
ANALYSIS_TIME=$(grep -o "Total directory analysis took: [0-9.]*s" pr_analysis.txt | grep -o "[0-9.]*s" || echo "N/A")
|
FILES_COUNT=$(grep -E "found [0-9]+ files" pr_analysis.txt | grep -oE "[0-9]+" || echo "0")
|
||||||
|
ANALYSIS_TIME=$(grep -E "Total.*took: [0-9.]+s" pr_analysis.txt | grep -oE "[0-9.]+s" || echo "N/A")
|
||||||
|
LANGUAGES=$(grep -A 10 "言語別:" pr_analysis.txt | grep -E "• \w+:" | wc -l || echo "1")
|
||||||
|
|
||||||
echo "files_analyzed=$FILES_COUNT" >> $GITHUB_OUTPUT
|
echo "files_analyzed=$FILES_COUNT" >> $GITHUB_OUTPUT
|
||||||
echo "analysis_time=$ANALYSIS_TIME" >> $GITHUB_OUTPUT
|
echo "analysis_time=$ANALYSIS_TIME" >> $GITHUB_OUTPUT
|
||||||
|
echo "languages_detected=$LANGUAGES" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Generate Impact Report
|
- name: Generate Impact Report
|
||||||
run: |
|
run: |
|
||||||
PR_FILES=${{ steps.analyze-pr.outputs.files_analyzed }}
|
PR_FILES=${{ steps.analyze-pr.outputs.files_analyzed }}
|
||||||
ANALYSIS_TIME=${{ steps.analyze-pr.outputs.analysis_time }}
|
ANALYSIS_TIME=${{ steps.analyze-pr.outputs.analysis_time }}
|
||||||
|
LANGUAGES_COUNT=${{ steps.analyze-pr.outputs.languages_detected }}
|
||||||
|
|
||||||
cat > impact_report.md << EOF
|
cat > impact_report.md << EOF
|
||||||
## 🦀 NekoCode Analysis Report
|
## 🦀 NekoCode 分析レポート
|
||||||
|
|
||||||
### 📊 Code Impact Summary
|
### 📊 コードの影響の概要
|
||||||
|
|
||||||
| Metric | Value |
|
| メトリック | 価値 |
|
||||||
|--------|-------|
|
|-----------|------|
|
||||||
| **Files Analyzed** | ${PR_FILES} files |
|
| **分析されたファイル** | ${PR_FILES} ファイル |
|
||||||
| **Analysis Time** | ${ANALYSIS_TIME} |
|
| **分析時間** | ${ANALYSIS_TIME} |
|
||||||
| **Languages Detected** | Rust |
|
| **検出された言語** | ${LANGUAGES_COUNT}言語 |
|
||||||
|
|
||||||
### ✅ Analysis Status
|
### ✅ 分析ステータス
|
||||||
|
|
||||||
- **Code Quality**: NekoCode analysis completed successfully
|
- **コード品質**: NekoCode分析が正常完了
|
||||||
- **Performance**: Analysis completed in ${ANALYSIS_TIME}
|
- **パフォーマンス**: 分析時間 ${ANALYSIS_TIME}
|
||||||
- **Compatibility**: All detected files processed without errors
|
- **互換性**: 検出されたファイルがエラーなしで処理完了
|
||||||
|
|
||||||
---
|
---
|
||||||
*🚀 Analysis powered by [NekoCode](https://github.com/moe-charm/nekocode-rust)*
|
*🚀 [NekoCode](https://github.com/moe-charm/nekocode-rust)による分析*
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
- name: Comment PR
|
- name: Comment PR
|
||||||
@ -81,7 +94,7 @@ jobs:
|
|||||||
});
|
});
|
||||||
|
|
||||||
const nekocodeComment = comments.data.find(comment =>
|
const nekocodeComment = comments.data.find(comment =>
|
||||||
comment.body.includes('🦀 NekoCode Analysis Report')
|
comment.body.includes('🦀 NekoCode 分析レポート')
|
||||||
);
|
);
|
||||||
|
|
||||||
if (nekocodeComment) {
|
if (nekocodeComment) {
|
||||||
|
|||||||
Reference in New Issue
Block a user