Skip to content

Commit 2962ace

Browse files
committed
add badges nightly workflow
1 parent bbf84d9 commit 2962ace

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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

0 commit comments

Comments
 (0)