q6 image #85
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |