-
Notifications
You must be signed in to change notification settings - Fork 254
78 lines (70 loc) · 2.01 KB
/
update-badge.yml
File metadata and controls
78 lines (70 loc) · 2.01 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Update Model Count Badge
on:
push:
branches: [main]
paths:
- 'Q-Series/**'
- 'Q-Pro-Series/**'
- 'Q-HE-Series/**'
- 'K-Pro-Series/**'
- 'K-Max-Series/**'
- 'K-HE-Series/**'
- 'V-Max-Series/**'
- 'P-HE-Series/**'
- 'L-Series/**'
- 'Mice/**'
- 'Keycap Profiles/**'
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: |
# Only count actual device model directories (not Keycap Profiles)
SERIES_DIRS=(
"Q-Series"
"Q-Pro-Series"
"Q-HE-Series"
"K-Pro-Series"
"K-Max-Series"
"K-HE-Series"
"V-Max-Series"
"P-HE-Series"
"L-Series"
"Mice"
)
COUNT=0
for dir in "${SERIES_DIRS[@]}"; do
if [ -d "$dir" ]; then
n=$(find "$dir" -mindepth 1 -maxdepth 1 -type d | wc -l)
echo " $dir: $n models"
COUNT=$((COUNT + n))
fi
done
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