Update GitHub Stats #3
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 GitHub Stats | |
| on: | |
| schedule: | |
| # Run every Sunday at midnight UTC | |
| - cron: '0 0 * * 0' | |
| workflow_dispatch: # Allow manual trigger | |
| permissions: | |
| contents: write | |
| jobs: | |
| update-stats: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Run stats update | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Run multiple times to handle rate limiting | |
| for i in {1..5}; do | |
| echo "=== Run $i ===" | |
| python3 scripts/update_stats.py | |
| sleep 60 | |
| done | |
| - name: Commit and push if changed | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add data/stats.json | |
| git diff --staged --quiet || git commit -m "📊 Update GitHub stats [automated]" | |
| git push |