Update Problem Solving Statistics #11
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 Problem Solving Statistics | |
| on: | |
| schedule: | |
| # Run every week on Sunday at 00:00 UTC | |
| - cron: '0 0 * * 0' | |
| workflow_dispatch: # Allow manual trigger | |
| jobs: | |
| update-stats: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # Required to push changes to repository | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Fetch latest statistics and update README | |
| id: fetch_stats | |
| run: | | |
| python3 update_stats.py 2>&1 | tee stats_output.txt | |
| - name: Commit and push if changed | |
| run: | | |
| git config --global user.name 'GitHub Action' | |
| git config --global user.email 'action@github.com' | |
| git add README.md | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Auto-update: Problem solving statistics ($(date +'%Y-%m-%d'))" | |
| git push | |
| fi |