-
Notifications
You must be signed in to change notification settings - Fork 244
44 lines (38 loc) · 1.19 KB
/
update-badge.yml
File metadata and controls
44 lines (38 loc) · 1.19 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
name: Update Model Count Badge
on:
push:
branches: [main]
workflow_dispatch:
jobs:
count-models:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Count model directories
id: count
run: |
COUNT=$(python3 docs/scripts/repo_inventory.py count --device-only)
echo "Total models: $COUNT"
echo "count=$COUNT" >> "$GITHUB_OUTPUT"
- name: Write badge JSON
run: |
mkdir -p .github/badges
cat > .github/badges/model-count.json << EOF
{
"schemaVersion": 1,
"label": "models uploaded",
"message": "${{ steps.count.outputs.count }}",
"color": "brightgreen",
"namedLogo": "github"
}
EOF
- name: Commit badge update
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .github/badges/model-count.json
git diff --staged --quiet || git commit -m "chore: update model count badge [skip ci]"
git push