Files
ruflo/.github/workflows/clone-tracker.yml
T
randRuFlo 53f95e36e6 feat(funnel): honor opt-outs in the messages fetch, wire opt-in telemetry, fix clone tracker
Operational telemetry (ADR-309, legitimate interest):
- `hooks refresh-funnel` (SessionStart) checked only the RUFLO_FUNNEL env
  kill switch. `ruflo funnel disable`, project config, enterprise policy and
  a declined disclosure all still called funnel.ruv.io every session. It now
  resolves the full funnel precedence and makes no request when disabled.
- The fetch's User-Agent adds the CLI release and OS/CPU family only:
  `ruflo-funnel/messages ruflo/<v> (<platform>; <arch>)`, sanitized to token
  characters. The live endpoint accepts it.
- docs/privacy/funnel-legitimate-interest-assessment.md is the assessment
  ADR-309 requires. ADR-309 links it, and ADR-310's acceptance rule now names
  the one documented default request.

Opt-in telemetry (ADR-302/305):
- `ruflo funnel telemetry on|off|status` is the only way to grant the
  telemetry consent domain. Nothing granted it before, so the event queue
  never left the machine.
- With consent, refresh-funnel flushes queued events once per session.
- `funnel disable` and `telemetry off` revoke consent and delete the ID and
  the local queue.

Clone tracker:
- A failed traffic fetch was recorded as 0 clones (snapshots #15-#18 read 0
  while GitHub reported ~258k in 14 days). The script now exits 1 and writes
  nothing.
- The workflow reads TRAFFIC_TOKEN, falling back to GITHUB_TOKEN, because
  the traffic API needs push access.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-11-06 11:05:25 -05:00

87 lines
3.1 KiB
YAML

name: Clone Tracker (14-day rolling)
# GitHub's clone API only retains 14 days. We run every 13 days so we always
# catch the full window with a 24h safety margin. The job appends a snapshot
# to `data/clone-data.rvf` (RuVector vector store) + `data/clone-data.ledger.json`
# (chronological JSON), regenerates `data/clone-data.proof.json` with a fresh
# SHA-256 over the ledger, and commits the result back to main.
#
# Schedule: every 13 days at 06:17 UTC (off-peak; avoids the :00 mark to
# spread cron load).
#
# Why we own this rather than rely on a third-party traffic-tracker: GitHub's
# clone API requires push access, so we'd have to give a stranger our token.
# Running it ourselves keeps the data path inside the repo and signed.
on:
schedule:
- cron: '17 6 */13 * *'
workflow_dispatch:
# Allow manual runs (e.g., after a release announcement to capture the spike).
push:
branches: [main]
paths:
- 'scripts/track-clones.mjs'
- '.github/workflows/clone-tracker.yml'
permissions:
contents: write # to push the snapshot commit
actions: read
concurrency:
group: clone-tracker
cancel-in-progress: false
jobs:
track:
name: Snapshot clones for ruflo ecosystem
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 1
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install root deps (for @ruvector/rvf binding)
run: npm install --legacy-peer-deps --no-audit --no-fund --ignore-scripts
- name: Run clone tracker
env:
# The traffic API needs push access, which the Actions GITHUB_TOKEN
# lacks. TRAFFIC_TOKEN is a fine-grained PAT with Administration: read.
GH_TOKEN: ${{ secrets.TRAFFIC_TOKEN || secrets.GITHUB_TOKEN }}
run: node scripts/track-clones.mjs
- name: Show resulting artifacts
run: |
ls -la data/clone-data.* 2>/dev/null || echo "(no artifacts produced)"
echo ""
echo "--- proof ---"
cat data/clone-data.proof.json
- name: Commit + push snapshot
run: |
git config user.name "ruflo-bot"
git config user.email "ruflo-bot@users.noreply.github.com"
git add data/clone-data.rvf data/clone-data.ledger.json data/clone-data.proof.json
if git diff --cached --quiet; then
echo "No changes to commit (snapshot identical to previous?)"
exit 0
fi
SNAP_COUNT=$(node -e "console.log(JSON.parse(require('fs').readFileSync('data/clone-data.proof.json','utf8')).ledger_snapshot_count)")
CLONES=$(node -e "console.log(JSON.parse(require('fs').readFileSync('data/clone-data.proof.json','utf8')).latest_snapshot.clones_14d.toLocaleString())")
git commit -m "chore(data): clone snapshot #${SNAP_COUNT} — ${CLONES} clones (14d)
Auto-generated by .github/workflows/clone-tracker.yml.
Source: GitHub Traffic API (14-day rolling window).
Co-Authored-By: ruflo-bot <ruflo-bot@users.noreply.github.com>"
git push origin main