feat: Comprehensive project improvements from 10-agent deep analysis #15
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: AI Code Review | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| push: | |
| branches: [main, develop] | |
| jobs: | |
| ai-review: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| issues: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Install AIOps | |
| run: | | |
| pip install --upgrade pip | |
| pip install git+https://github.com/${{ github.repository }}.git@${{ github.ref }} | |
| - name: Review changed files | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| run: | | |
| # Get changed Python files | |
| changed_files=$(git diff --name-only origin/${{ github.base_ref }}...${{ github.head_ref }} | grep '\.py$' || echo "") | |
| if [ -z "$changed_files" ]; then | |
| echo "No Python files changed" | |
| exit 0 | |
| fi | |
| # Review each changed file | |
| for file in $changed_files; do | |
| echo "Reviewing $file..." | |
| aiops review "$file" --language python > "${file}.review.txt" | |
| done | |
| - name: Post review comments | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const path = require('path'); | |
| // Find all review files | |
| const reviewFiles = fs.readdirSync('.') | |
| .filter(f => f.endsWith('.review.txt')); | |
| let comment = '## 🤖 AI Code Review Results\n\n'; | |
| for (const file of reviewFiles) { | |
| const fileName = file.replace('.review.txt', ''); | |
| const content = fs.readFileSync(file, 'utf8'); | |
| comment += `### ${fileName}\n\`\`\`\n${content}\n\`\`\`\n\n`; | |
| } | |
| // Post comment on PR | |
| github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: comment | |
| }); | |
| - name: Security scan | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| run: | | |
| echo "Running security scan..." | |
| # Security scan could be added here | |
| # aiops security-scan . --output security-report.md | |
| - name: Upload review artifacts | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: ai-reviews | |
| path: '*.review.txt' | |
| retention-days: 30 |