feat(aios-dashboard): AIOS Dashboard & ADE Implementation #98
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: PR Automation | |
| # Story 6.1: Simplified to metrics-only (validation moved to ci.yml) | |
| # Purpose: Coverage reporting, quality summary, and metrics recording | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| types: [opened, synchronize, reopened] | |
| concurrency: | |
| group: pr-automation-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| checks: write | |
| env: | |
| NODE_VERSION: '20' | |
| jobs: | |
| # ============================================================================ | |
| # COVERAGE EXTRACTION & REPORTING | |
| # ============================================================================ | |
| coverage-report: | |
| name: Coverage Report | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| outputs: | |
| coverage-summary: ${{ steps.coverage.outputs.summary }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests with coverage | |
| run: npm run test:coverage | |
| continue-on-error: true | |
| - name: Extract coverage summary | |
| id: coverage | |
| run: | | |
| if [ -f coverage/coverage-summary.json ]; then | |
| LINES=$(jq '.total.lines.pct' coverage/coverage-summary.json) | |
| STATEMENTS=$(jq '.total.statements.pct' coverage/coverage-summary.json) | |
| BRANCHES=$(jq '.total.branches.pct' coverage/coverage-summary.json) | |
| FUNCTIONS=$(jq '.total.functions.pct' coverage/coverage-summary.json) | |
| echo "summary=Lines: ${LINES}% | Statements: ${STATEMENTS}% | Branches: ${BRANCHES}% | Functions: ${FUNCTIONS}%" >> $GITHUB_OUTPUT | |
| else | |
| echo "summary=Coverage report not available" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./coverage/lcov.info | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| # ============================================================================ | |
| # PR COMMENTS (Coverage + Quality Summary) | |
| # ============================================================================ | |
| post-comments: | |
| name: Post PR Comments | |
| runs-on: ubuntu-latest | |
| needs: [coverage-report] | |
| if: always() | |
| steps: | |
| - name: Post coverage comment | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const coverageSummary = '${{ needs.coverage-report.outputs.coverage-summary }}' || 'Coverage data not available'; | |
| const body = `## 📊 Coverage Report | |
| ${coverageSummary} | |
| > 📈 Full coverage report available in [Codecov](https://codecov.io/gh/${{ github.repository }}/pull/${{ github.event.pull_request.number }}) | |
| --- | |
| *Generated by PR Automation (Story 6.1)* | |
| `; | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const botComment = comments.find(comment => | |
| comment.user.type === 'Bot' && | |
| comment.body.includes('📊 Coverage Report') | |
| ); | |
| if (botComment) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: botComment.id, | |
| body: body | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: body | |
| }); | |
| } | |
| # ============================================================================ | |
| # CODERABBIT STATUS CHECK | |
| # ============================================================================ | |
| coderabbit-check: | |
| name: CodeRabbit Status | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 2 | |
| steps: | |
| - name: Verify CodeRabbit config exists | |
| uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: .coderabbit.yaml | |
| sparse-checkout-cone-mode: false | |
| - name: Validate config | |
| run: | | |
| echo "🐰 CodeRabbit Integration Status" | |
| echo "================================" | |
| if [ -f ".coderabbit.yaml" ]; then | |
| echo "✅ CodeRabbit configuration found" | |
| else | |
| echo "⚠️ CodeRabbit configuration not found" | |
| fi | |
| echo "" | |
| echo "Note: CodeRabbit reviews are handled by the GitHub App" | |
| # ============================================================================ | |
| # METRICS RECORDING (Story 3.11c) | |
| # ============================================================================ | |
| record-metrics: | |
| name: Record Quality Metrics | |
| runs-on: ubuntu-latest | |
| needs: [coverage-report] | |
| if: always() | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Record PR metrics | |
| env: | |
| COVERAGE_RESULT: ${{ needs.coverage-report.result }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| BRANCH_NAME: ${{ github.head_ref }} | |
| AUTHOR: ${{ github.actor }} | |
| run: | | |
| node -e " | |
| const { recordPRReviewMetrics } = require('./.aios-core/quality/metrics-hook'); | |
| (async () => { | |
| const passed = process.env.COVERAGE_RESULT === 'success'; | |
| await recordPRReviewMetrics({ | |
| passed, | |
| durationMs: 180000, | |
| findingsCount: 0, | |
| metadata: { | |
| prNumber: parseInt(process.env.PR_NUMBER, 10), | |
| branchName: process.env.BRANCH_NAME, | |
| author: process.env.AUTHOR, | |
| coverageResult: process.env.COVERAGE_RESULT | |
| } | |
| }); | |
| console.log('✅ PR metrics recorded'); | |
| })().catch(err => { | |
| console.warn('⚠️ Failed to record metrics:', err.message); | |
| process.exit(0); | |
| }); | |
| " | |
| - name: Commit metrics update | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| if [ -f .aios/data/quality-metrics.json ]; then | |
| git add .aios/data/quality-metrics.json | |
| fi | |
| if ! git diff --staged --quiet; then | |
| git commit -m "chore(metrics): update quality metrics [skip ci]" | |
| git push || echo "Push skipped (may conflict with parallel runs)" | |
| else | |
| echo "ℹ️ No metrics changes to commit" | |
| fi |