Collect Analytics #271
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: Collect Analytics | |
| on: | |
| schedule: | |
| # Run daily at 6:00 AM UTC (12:00 AM Denver / MDT) | |
| - cron: '0 6 * * *' | |
| workflow_dispatch: # Allow manual trigger | |
| permissions: | |
| contents: write | |
| jobs: | |
| collect: | |
| runs-on: ubuntu-latest | |
| env: | |
| # Opt the bundled JS actions (checkout/setup-node) into the Node 24 runtime | |
| # ahead of the 2026-06-16 forced cutover, silencing the Node 20 deprecation | |
| # warning. Remove once the actions ship Node 24-native majors. | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GH_STATS_TOKEN || github.token }} | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Setup database (if needed) | |
| run: npm run setup-db | |
| - name: Collect GitHub stats | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GH_STATS_TOKEN }} | |
| GITHUB_ORG: opena2a-org,opena2a-standards,ecolibria | |
| run: npm run collect | |
| - name: Collect npm stats | |
| env: | |
| NPM_AUTHOR: ecolibria | |
| # Scoped @opena2a/* packages are pinned explicitly because npm | |
| # author-discovery does not reliably return scoped packages. | |
| NPM_PACKAGES: opena2a-cli,@opena2a/aicomply | |
| run: npm run collect-npm | |
| - name: Collect PyPI stats | |
| env: | |
| # PyPI has no author-discovery API (profile pages are bot-gated). | |
| # New packages are auto-discovered by scanning GITHUB_ORG repos for | |
| # Python packaging files (see collect-pypi-stats.js). PYPI_PACKAGES | |
| # remains a safety-net for packages whose repo lives outside these | |
| # orgs or isn't discoverable. | |
| GITHUB_TOKEN: ${{ secrets.GH_STATS_TOKEN }} | |
| GITHUB_ORG: opena2a-org,opena2a-standards,ecolibria | |
| PYPI_PACKAGES: cryptoserve,cryptoserve-core,cryptoserve-auto,cryptoserve-client,aim-sdk,aicomply | |
| run: npm run collect-pypi | |
| - name: Collect Docker stats | |
| env: | |
| DOCKER_IMAGES: opena2a/dvaa,opena2a/aim-server,opena2a/aim-dashboard | |
| run: npm run collect-docker | |
| - name: Collect HuggingFace stats | |
| env: | |
| HF_AUTHOR: opena2a | |
| run: npm run collect-hf | |
| - name: Collect Chrome Web Store stats | |
| env: | |
| # Chrome Web Store extension ids (no install/download API exists; the | |
| # collector scrapes the public listing's rounded weekly-active-user | |
| # count, a snapshot shown for context and never summed into adoption). | |
| CHROME_EXTENSIONS: ojphpdmabflmcjhglfogmkdgchkncikf | |
| run: npm run collect-chrome | |
| - name: Collect first-party CLI telemetry | |
| env: | |
| # Registry base URL exposing the coarse public adoption feed | |
| # (GET /api/v1/telemetry/v1/adoption/public). Only coarse, anonymous | |
| # active-user aggregates are collected here; fine-grained detail is | |
| # never persisted. Unset -> the collector skips gracefully. | |
| REGISTRY_URL: ${{ vars.REGISTRY_URL }} | |
| run: npm run collect-telemetry | |
| - name: Generate markdown files | |
| run: npm run generate-md | |
| - name: Generate summary JSON | |
| run: npm run generate-summary | |
| - name: Commit and push changes | |
| run: | | |
| git config user.name "GitHub Actions Bot" | |
| git config user.email "actions@github.com" | |
| git add data/analytics.db data/badge-*.json data/stats-*.json data/npm-stats-*.json data/pypi-stats-*.json data/docker-badge-*.json data/hf-badge-*.json data/chrome-badge-*.json data/chrome-stats-*.json data/telemetry-badge.json data/summary.json ANALYTICS.md ANALYTICS_DETAILED.md | |
| git diff --staged --quiet || git commit -m "chore: update analytics data [skip ci]" | |
| git push || echo "No changes to push" |