This repository was archived by the owner on Apr 5, 2026. It is now read-only.
Weekly Metrics Collection #35
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: Weekly Metrics Collection | |
| on: | |
| schedule: | |
| - cron: '0 6 * * 1' # Every Monday at 06:00 UTC | |
| workflow_dispatch: # Manual trigger | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'claude/rules/**' | |
| - 'scripts/generate-dashboard.py' | |
| permissions: | |
| contents: write | |
| actions: read | |
| pull-requests: read | |
| jobs: | |
| collect: | |
| name: Collect PR metrics | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Collect PR metrics for all repos | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| mkdir -p ~/databases | |
| # Run collection for DevKit itself | |
| bash scripts/collect-pr-metrics.sh --repo HerbHall/devkit --days 30 --db ~/databases/claude.db | |
| # Export summary as JSON artifact | |
| sqlite3 ~/databases/claude.db -json \ | |
| "SELECT repo, COUNT(*) as prs, ROUND(AVG(push_count),1) as avg_pushes, ROUND(100.0*SUM(ci_first_pass)/COUNT(*),0) as first_pass_pct, SUM(fix_push_cycles) as fix_cycles FROM pr_metrics WHERE merged_at >= date('now','-30 days') GROUP BY repo;" \ | |
| > metrics-summary.json || echo "[]" > metrics-summary.json | |
| cat metrics-summary.json | |
| - name: Generate dashboard | |
| run: | | |
| python scripts/generate-dashboard.py --db ~/databases/claude.db --output metrics/dashboard.html | |
| - name: Commit updated dashboard | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add metrics/dashboard.html | |
| if git diff --cached --quiet; then | |
| echo "No dashboard changes to commit" | |
| else | |
| git commit -m "chore(metrics): auto-regenerate dashboard [skip ci]" | |
| git push | |
| fi | |
| - name: Upload metrics artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: metrics-${{ github.run_number }} | |
| path: metrics-summary.json | |
| retention-days: 90 |