Update ortools version to 9.15.6755 #13
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: AIPCSS Bot Reviewer | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| permissions: | |
| pull-requests: write | |
| contents: read | |
| checks: read | |
| jobs: | |
| # -- Backend Job -- | |
| lint-backend: | |
| name: Backend Quality | |
| runs-on: ubuntu-latest | |
| outputs: | |
| failed: ${{ steps.check.outputs.failed }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| - name: Install Tools | |
| run: pip install flake8 bandit | |
| - name: Run Checks | |
| id: check | |
| run: | | |
| echo "## Backend Report" > backend_report.md | |
| PY_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '^backend/.*\.py$' || true) | |
| if [ -n "$PY_FILES" ]; then | |
| set +e | |
| flake8 $PY_FILES --max-line-length=120 > f8.txt 2>&1 | |
| F8_EXIT=$? | |
| bandit $PY_FILES -f txt > b.txt 2>&1 | |
| B_EXIT=$? | |
| set -e | |
| if [ $F8_EXIT -ne 0 ] || [ $B_EXIT -ne 0 ]; then | |
| echo "failed=true" >> $GITHUB_OUTPUT | |
| echo "### Issues Found" >> backend_report.md | |
| [ $F8_EXIT -ne 0 ] && echo "#### Flake8" >> backend_report.md && echo "\`\`\`" >> backend_report.md && cat f8.txt >> backend_report.md && echo "\`\`\`" >> backend_report.md | |
| [ $B_EXIT -ne 0 ] && echo "#### Bandit Security" >> backend_report.md && echo "\`\`\`" >> backend_report.md && cat b.txt >> backend_report.md && echo "\`\`\`" >> backend_report.md | |
| else | |
| echo "Passed: Backend quality checks passed." >> backend_report.md | |
| fi | |
| else | |
| echo "No Python files changed." >> backend_report.md | |
| fi | |
| - name: Upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: backend-report | |
| path: backend_report.md | |
| # -- Frontend Job -- | |
| lint-frontend: | |
| name: Frontend Quality | |
| runs-on: ubuntu-latest | |
| outputs: | |
| failed: ${{ steps.check.outputs.failed }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install | |
| working-directory: frontend | |
| run: npm ci | |
| - name: Run Checks | |
| id: check | |
| run: | | |
| echo "## Frontend Report" > frontend_report.md | |
| TS_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '^frontend/src/.*\.\(ts\|tsx\)$' || true) | |
| if [ -n "$TS_FILES" ]; then | |
| set +e | |
| npx eslint $TS_FILES > es.txt 2>&1 | |
| ES_EXIT=$? | |
| cd frontend && npx tsc --noEmit > ../tsc.txt 2>&1 | |
| TSC_EXIT=$? | |
| cd .. | |
| set -e | |
| if [ $ES_EXIT -ne 0 ] || [ $TSC_EXIT -ne 0 ]; then | |
| echo "failed=true" >> $GITHUB_OUTPUT | |
| echo "### Issues Found" >> frontend_report.md | |
| [ $ES_EXIT -ne 0 ] && echo "#### ESLint" >> frontend_report.md && echo "\`\`\`" >> frontend_report.md && cat es.txt >> frontend_report.md && echo "\`\`\`" >> frontend_report.md | |
| [ $TSC_EXIT -ne 0 ] && echo "#### TypeScript" >> frontend_report.md && echo "\`\`\`" >> frontend_report.md && cat tsc.txt >> frontend_report.md && echo "\`\`\`" >> frontend_report.md | |
| else | |
| echo "Passed: Frontend quality checks passed." >> frontend_report.md | |
| fi | |
| else | |
| echo "No TypeScript files changed." >> frontend_report.md | |
| fi | |
| - name: Upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: frontend-report | |
| path: frontend_report.md | |
| # -- AI Review & Decision Job -- | |
| ai-review: | |
| name: AI Review and Approval | |
| needs: [lint-backend, lint-frontend] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download Reports | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: '*-report' | |
| merge-multiple: true | |
| - name: Gemini AI Review | |
| env: | |
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
| run: | | |
| echo "## AI Logic Review" > ai_report.md | |
| if [ -z "$GEMINI_API_KEY" ]; then | |
| echo "Warning: AI Review skipped (Secret missing)." >> ai_report.md | |
| else | |
| DIFF=$(git diff origin/${{ github.base_ref }}...HEAD | head -c 15000) | |
| CLEAN_DIFF=$(echo "$DIFF" | jq -aRs .) | |
| RESPONSE=$(curl -s -X POST "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=$GEMINI_API_KEY" \ | |
| -H "Content-Type: application/json" \ | |
| -d "{\"contents\": [{\"parts\":[{\"text\": \"Review this git diff for logic errors and performance. Respond in Markdown.\n\n$CLEAN_DIFF\"}]}]}") | |
| echo "$RESPONSE" | jq -r '.candidates[0].content.parts[0].text' >> ai_report.md | |
| fi | |
| - name: Post Decision | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const backend = fs.existsSync('backend_report.md') ? fs.readFileSync('backend_report.md', 'utf8') : 'No backend changes.'; | |
| const frontend = fs.existsSync('frontend_report.md') ? fs.readFileSync('frontend_report.md', 'utf8') : 'No frontend changes.'; | |
| const ai = fs.existsSync('ai_report.md') ? fs.readFileSync('ai_report.md', 'utf8') : 'AI review skipped.'; | |
| const hasFailed = '${{ needs.lint-backend.outputs.failed }}' === 'true' || '${{ needs.lint-frontend.outputs.failed }}' === 'true'; | |
| const reportBody = `## AIPCSS Bot Reviewer Report\n\n### Status: ${hasFailed ? 'Issues Found - Action Required' : 'All Quality Checks Passed'}\n\n---\n${ai}\n---\n${backend}\n---\n${frontend}`; | |
| // 1. Post Comment | |
| const { data: comments } = await github.rest.issues.listComments({ ...context.repo, issue_number: context.issue.number }); | |
| const botComment = comments.find(c => c.body.includes('AIPCSS Bot Reviewer Report')); | |
| if (botComment) { | |
| await github.rest.issues.updateComment({ ...context.repo, comment_id: botComment.id, body: reportBody }); | |
| } else { | |
| await github.rest.issues.createComment({ ...context.repo, issue_number: context.issue.number, body: reportBody }); | |
| } | |
| // 2. Set PR Status (Approve or Request Changes) | |
| await github.rest.pulls.createReview({ | |
| ...context.repo, | |
| pull_number: context.issue.number, | |
| event: hasFailed ? 'REQUEST_CHANGES' : 'APPROVE', | |
| body: hasFailed ? 'Bot Reviewer: Please fix the issues mentioned in the report.' : 'Bot Reviewer: All checks passed. Approved!' | |
| }); |