Skip to content

Community Stats

Community Stats #144

name: Community Stats
on:
schedule:
# Run at 3 AM UTC every day
- cron: '0 3 * * *'
workflow_dispatch:
permissions:
contents: write
jobs:
update-stats:
name: Update Community Stats
runs-on: ubuntu-latest
steps:
- name: Validate push token
env:
COMMUNITY_STATS_PUSH_TOKEN: ${{ secrets.COMMUNITY_STATS_PUSH_TOKEN }}
run: |
if [ -z "$COMMUNITY_STATS_PUSH_TOKEN" ]; then
echo "::error::COMMUNITY_STATS_PUSH_TOKEN is required because main is protected and the workflow must push with an admin token."
exit 1
fi
- uses: actions/checkout@v7
with:
token: ${{ secrets.COMMUNITY_STATS_PUSH_TOKEN }}
- name: Collect stats and update README
run: python3 .github/stats/update_stats.py
- name: Commit if changed
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add README.md .github/stats/history.json .github/stats/pypi_daily.json .github/stats/downloads.svg
git diff --cached --quiet && exit 0
git commit -m "chore: update community stats [skip ci]"
git push