PyPI downloads → PostHog #2
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: PyPI downloads → PostHog | |
| # Ships daily download counts for this repo's PyPI package to PostHog as | |
| # `pypi_download_daily` events. Re-sends the last 7 days on every run with a | |
| # deterministic event UUID, so missed or doubled cron runs are harmless. | |
| on: | |
| schedule: | |
| - cron: "0 6 * * *" # UTC; pypistats has yesterday's numbers by then | |
| workflow_dispatch: | |
| inputs: | |
| lookback_days: | |
| description: "Complete days to (re)send (pypistats keeps 180)" | |
| default: "7" | |
| required: false | |
| permissions: | |
| contents: read | |
| jobs: | |
| ship: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Ship download counts | |
| run: python scripts/pypi_to_posthog.py flapi-io | |
| env: | |
| POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} | |
| POSTHOG_HOST: https://eu.i.posthog.com | |
| LOOKBACK_DAYS: ${{ inputs.lookback_days || '7' }} |