Update AgentFolio Badges #101
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: Update AgentFolio Badges | |
| on: | |
| # Weekly schedule (Sunday at 00:00 UTC) | |
| schedule: | |
| - cron: '0 0 * * 0' | |
| # Run when data or scripts change | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'data/agents.json' | |
| - 'scripts/generate_badges.py' | |
| # Manual trigger | |
| workflow_dispatch: | |
| inputs: | |
| force_update: | |
| description: 'Force badge regeneration' | |
| required: false | |
| default: 'false' | |
| permissions: | |
| contents: write | |
| jobs: | |
| update-badges: | |
| runs-on: ubuntu-latest | |
| name: Generate and Update Badges | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Apply time-decay ranking | |
| run: | | |
| # Calculate decayed scores before badge generation | |
| python3 scripts/ranking_decay.py data/agents.json -o data/agents-ranked.json --algorithm exponential --half-life 90 --floor 0.3 | |
| echo "✅ Ranked agents with time decay applied" | |
| - name: Calculate agent scores | |
| run: | | |
| # Use the refactored score calculator | |
| python3 scripts/calculate_scores.py \ | |
| --input data/agents-ranked.json \ | |
| --output data/agents-scored.json \ | |
| --report | |
| echo "✅ Calculated agent scores" | |
| - name: Run badge generator | |
| id: generate | |
| run: | | |
| mkdir -p agentfolio/badges | |
| python3 scripts/generate_badges.py --input data/agents-scored.json --output agentfolio/badges | |
| echo "✅ Generated badges" | |
| - name: Check for changes | |
| id: check_changes | |
| run: | | |
| git add agentfolio/badges/ data/agents-scored.json | |
| if git diff --cached --quiet; then | |
| echo "has_changes=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "has_changes=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit and push changes | |
| if: steps.check_changes.outputs.has_changes == 'true' || github.event.inputs.force_update == 'true' | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git commit -m "Auto-update AgentFolio badges - Run ${{ github.run_id }}" | |
| git push | |
| - name: Summary | |
| run: | | |
| echo "## ✅ Badge Update Complete" >> $GITHUB_STEP_SUMMARY | |
| echo "**Changes:** ${{ steps.check_changes.outputs.has_changes }}" >> $GITHUB_STEP_SUMMARY | |
| echo "[View Badges](https://agentfolio.io/agentfolio/badges/)" >> $GITHUB_STEP_SUMMARY |