File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Update Problem Solving Statistics
2+
3+ on :
4+ schedule :
5+ # Run every week on Sunday at 00:00 UTC
6+ - cron : ' 0 0 * * 0'
7+ workflow_dispatch : # Allow manual trigger
8+
9+ jobs :
10+ update-stats :
11+ runs-on : ubuntu-latest
12+
13+ steps :
14+ - name : Checkout repository
15+ uses : actions/checkout@v4
16+
17+ - name : Set up Python
18+ uses : actions/setup-python@v5
19+ with :
20+ python-version : ' 3.12'
21+
22+ - name : Fetch latest statistics
23+ id : fetch_stats
24+ run : |
25+ python3 update_stats.py > stats_output.txt 2>&1 || true
26+ cat stats_output.txt
27+
28+ # Extract JSON output
29+ sed -n '/JSON Output:/,${p;/^}$/q}' stats_output.txt | tail -n +2 > stats.json
30+ cat stats.json
31+
32+ - name : Update README if stats were fetched
33+ run : |
34+ if [ -f stats.json ]; then
35+ echo "Statistics file found, updating README..."
36+ python3 update_readme.py
37+ else
38+ echo "No statistics file found, skipping README update"
39+ fi
40+
41+ - name : Commit and push if changed
42+ run : |
43+ git config --global user.name 'GitHub Action'
44+ git config --global user.email 'action@github.com'
45+ git add README.md last_known_counts.json
46+ if git diff --staged --quiet; then
47+ echo "No changes to commit"
48+ else
49+ git commit -m "Auto-update: Problem solving statistics ($(date +'%Y-%m-%d'))"
50+ git push
51+ fi
Original file line number Diff line number Diff line change 127127
128128## 📝 How to Update Statistics
129129
130- This repository tracks problem-solving statistics manually. To update:
130+ This repository tracks problem-solving statistics using a hybrid approach:
131+
132+ ### Automatic Updates (GitHub Actions)
133+ - Runs weekly on Sundays at 00:00 UTC
134+ - Automatically fetches statistics from platforms with working APIs
135+ - Failed platforms fall back to last known values with date stamps
136+ - Updates are pushed automatically to the repository
137+
138+ ### Manual Updates
139+ If you need to update statistics manually:
131140
1321411 . Run ` python3 manual_update.py ` to input current statistics
1331422 . The script will prompt you to visit each platform and enter the current solve count
1341433 . Statistics are automatically saved and the README is updated
135144
145+ ** Note:** Each platform shows the last update date in small text when using cached values.
146+
136147---
137148
138149<div align =" center " >
You can’t perform that action at this time.
0 commit comments