Repository navigation
Collect stats #8687
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
| # This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
| name: Collect stats | |
| on: | |
| push: | |
| branches: [ master ] | |
| # Don't activate until pushing has been disabled for PRs | |
| #pull_requests: | |
| # branches: [ master ] | |
| schedule: | |
| - cron: '0 */6 * * *' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: uv sync | |
| - name: Collect and append stats | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| uv run python3 collect_stats.py --csv >> data/stats.csv | |
| # releases() reuses dates already in data/releases.csv and only queries | |
| # the API for new releases, so this no longer exhausts the rate limit. | |
| # Write to a temp file first: `> data/releases.csv` would truncate the | |
| # file before the script gets to read the existing dates from it. | |
| uv run python3 collect_stats.py --releases --csv > data/releases.csv.tmp | |
| mv data/releases.csv.tmp data/releases.csv | |
| # Per-asset download counts (source for platform / per-version-per-platform | |
| # breakdowns). Appends only assets whose count changed since last logged. | |
| uv run python3 collect_stats.py --assets --csv >> data/stats-assets.csv | |
| - name: Commit | |
| run: | | |
| git config --local user.email "noreply@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add data/stats.csv data/releases.csv data/stats-assets.csv | |
| git commit -m "chore: update stats" | |
| - name: Push changes | |
| uses: ad-m/github-push-action@fe38f0a751bf9149f0270cc1fe20bf9156854365 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} |