diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index d7fd270..4a79ff1 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -60,35 +60,45 @@ jobs: echo "needs_review=$NEEDS_REVIEW" >> $GITHUB_OUTPUT # Create summary for comment - { - echo "SUMMARY<> $GITHUB_OUTPUT + cat > pr_comment.md <<'COMMENT_EOF' + ## 🤖 AGI Engineer Analysis Results + + **Total Issues Found:** TOTAL_ISSUES_PLACEHOLDER + + SAFE_ISSUES_PLACEHOLDER + NEEDS_REVIEW_PLACEHOLDER + + ### Details + ``` + ANALYSIS_DETAILS_PLACEHOLDER + ``` + + --- + *Run locally:* `python3 agi_engineer_v3.py . --smart --ai` + COMMENT_EOF + + # Replace placeholders + sed -i "s/TOTAL_ISSUES_PLACEHOLDER/$TOTAL_ISSUES/g" pr_comment.md + if [ "$SAFE_ISSUES" != "0" ]; then + sed -i "s/SAFE_ISSUES_PLACEHOLDER/✅ **Safe to Auto-Fix:** $SAFE_ISSUES issues/g" pr_comment.md + else + sed -i "s/SAFE_ISSUES_PLACEHOLDER//g" pr_comment.md + fi + if [ "$NEEDS_REVIEW" != "0" ]; then + sed -i "s/NEEDS_REVIEW_PLACEHOLDER/⚠️ **Needs Review:** $NEEDS_REVIEW issues/g" pr_comment.md + else + sed -i "s/NEEDS_REVIEW_PLACEHOLDER//g" pr_comment.md + fi + sed -i "/ANALYSIS_DETAILS_PLACEHOLDER/{r analysis.txt + d;}" pr_comment.md - name: Comment on PR uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | - const summary = `${{ steps.extract.outputs.SUMMARY }}`; + const fs = require('fs'); + const commentBody = fs.readFileSync('pr_comment.md', 'utf8'); // Find existing comment const comments = await github.rest.issues.listComments({ @@ -102,8 +112,6 @@ jobs: comment.body.includes('AGI Engineer Analysis') ); - const commentBody = summary; - if (botComment) { // Update existing comment await github.rest.issues.updateComment({ @@ -134,7 +142,7 @@ jobs: fi - name: Upload analysis artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: agi-engineer-analysis path: analysis.txt diff --git a/test_demo.py b/test_demo.py new file mode 100644 index 0000000..392c580 --- /dev/null +++ b/test_demo.py @@ -0,0 +1,15 @@ +# Test file to trigger AGI Engineer workflows +import os # unused import +import sys # unused import + + +def func(a, b): # poor name, unused var + temp = a + b # unused variable + result = a * b + return result + +# Useless f-string +message = f"Hello World" + +print(message) +# Updated for AI analysis test