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