Skip to content

Refresh data-growth metrics #108

Refresh data-growth metrics

Refresh data-growth metrics #108

name: Refresh data-growth metrics
# Re-runs the three scripts under scripts/*.mjs that walk git history and
# emit data/metrics/*.{csv,json} (folder counts, .json file counts, JSON
# record counts) for the /stats page's growth charts. Opens a PR with the
# regenerated files when anything changes.
on:
schedule:
# Daily 03:15 UTC. Off-peak; quorum.yml runs at 06:00.
- cron: "15 3 * * *"
workflow_dispatch:
concurrency:
group: refresh-metrics
cancel-in-progress: false
permissions:
contents: write
pull-requests: write
jobs:
refresh:
runs-on: ubuntu-latest
# Record-counts walks every JSON blob at every first-parent commit on
# main. Local runs land at ~17 min on a stale repo; budget headroom.
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
# Full history needed — the scripts iterate `git log --first-parent`.
fetch-depth: 0
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Regenerate folder counts
run: node scripts/folder-counts-over-time.mjs
- name: Regenerate .json file counts
run: node scripts/json-file-counts-over-time.mjs
- name: Regenerate JSON record counts
run: node scripts/json-record-counts-over-time.mjs
- name: Open metrics-refresh PR if anything changed
uses: peter-evans/create-pull-request@v7
with:
commit-message: "[metrics] refresh data-growth time-series"
title: "[metrics] data-growth refresh — ${{ github.run_number }}"
body: |
Automated refresh of `data/metrics/*.{csv,json}` powering the
`/stats` Growth-over-time charts. Generated by
`.github/workflows/refresh-metrics.yml` from the three scripts
under `scripts/`. See the workflow run for output.
branch: metrics/auto-refresh-${{ github.run_number }}
add-paths: data/metrics/**
delete-branch: true