name: Adoption stats (maintainer-only)
# Posts unified PyPI install + docs-traffic numbers to the workflow run summary,
# which is visible ONLY to repo collaborators. Nothing is published publicly.
on:
  schedule:
    - cron: '0 6 * * *'
  workflow_dispatch: {}
permissions:
  contents: read
jobs:
  stats:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: 20 }
      - name: Fetch + summarize stats (private to collaborators)
        env:
          # public stars/forks work with the default token; unique cloners/viewers
          # need a maintainer PAT with Administration: read (STATS_GITHUB_TOKEN).
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          STATS_GITHUB_TOKEN: ${{ secrets.STATS_GITHUB_TOKEN }}
          GOATCOUNTER_TOKEN: ${{ secrets.GOATCOUNTER_TOKEN }}
          GOATCOUNTER_SITE: ${{ secrets.GOATCOUNTER_SITE }}
        run: node website/scripts/fetch-stats.mjs >> "$GITHUB_STEP_SUMMARY"
