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 Download Badges
2+
3+ on :
4+ schedule :
5+ - cron : " 0 0 * * *" # nightly at midnight UTC
6+ workflow_dispatch : # manual trigger
7+
8+ jobs :
9+ update-badges :
10+ runs-on : ubuntu-latest
11+ permissions :
12+ contents : write
13+ steps :
14+ - name : Checkout badges branch
15+ uses : actions/checkout@v4
16+ with :
17+ ref : badges
18+ fetch-depth : 0
19+
20+ - name : Fetch HF downloads
21+ run : |
22+ mkdir -p badges
23+
24+ RESPONSE=$(curl -s "https://huggingface.co/api/models/Dogacel/Universal-DeepSeek-OCR-2?expand[]=downloadsAllTime")
25+ ALL_TIME=$(echo "$RESPONSE" | jq '.downloadsAllTime')
26+ MONTHLY=$(echo "$RESPONSE" | jq '.downloads')
27+
28+ cat > badges/downloads-all-time.json <<EOF
29+ {
30+ "schemaVersion": 1,
31+ "label": "Downloads (All Time)",
32+ "message": "$ALL_TIME",
33+ "color": "green"
34+ }
35+ EOF
36+
37+ cat > badges/downloads-monthly.json <<EOF
38+ {
39+ "schemaVersion": 1,
40+ "label": "Downloads (Monthly)",
41+ "message": "$MONTHLY",
42+ "color": "green"
43+ }
44+ EOF
45+
46+ - name : Commit and push
47+ run : |
48+ git config user.name "github-actions[bot]"
49+ git config user.email "github-actions[bot]@users.noreply.github.com"
50+ git add badges/
51+ git diff --cached --quiet || git commit -m "Update download badges"
52+ git push
You can’t perform that action at this time.
0 commit comments