Skip to content

ci: add daily workflow to track .archgate adoption via PostHog#205

Merged
rhuanbarreto merged 4 commits into
mainfrom
ci/track-github-adoption
Apr 13, 2026
Merged

ci: add daily workflow to track .archgate adoption via PostHog#205
rhuanbarreto merged 4 commits into
mainfrom
ci/track-github-adoption

Conversation

@rhuanbarreto

@rhuanbarreto rhuanbarreto commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • New scheduled workflow (.github/workflows/track-adoption.yml) that runs daily at 08:00 UTC.
  • Queries GitHub code-search for path:.archgate/, dedupes to unique public repos, and emits one archgate_repo_seen event per repo to PostHog's /batch/ endpoint.
  • distinct_id = owner/name — each repo becomes a PostHog "person", so first-seen / last-seen and per-repo timelines come for free. $set populates the person properties (owner, name, full_name, url, is_fork).
  • Exposes workflow_dispatch for manual runs.

How to chart cumulative adoption in PostHog

No ingestion-level dedup needed. Build a Trend insight:

  • Event: archgate_repo_seen
  • Math: Unique users
  • Display: Cumulative

Each repo counts once regardless of how many events it's generated across daily runs.

Required configuration

Before the first run will succeed, add these in Settings → Secrets and variables → Actions:

Secrets

  • GH_SEARCH_TOKEN — classic PAT with public_repo scope. The default GITHUB_TOKEN is an app-installation token and isn't guaranteed to work against the code-search API.
  • POSTHOG_API_KEY — PostHog Project API Key (the public phc_... token, not a personal key).

Variables (optional)

  • POSTHOG_HOST — defaults to https://eu.i.posthog.com. Set if on US cloud or self-hosted.

Caveats

  • Code search skips very large / vendored files and non-default branches — the repo set is a lower bound.
  • Results are capped at 1000 per query (currently ~300 file matches → ~3x headroom); re-shard before we saturate.
  • archgate/cli itself counts toward the total since it contains .archgate/. Consistent day-over-day, just noting it.
  • Treating each repo as a "person" conflates repos with real users if you later add user tracking to the same project. Easy migration to PostHog Groups later if that becomes an issue.

Test plan

  • Add GH_SEARCH_TOKEN and POSTHOG_API_KEY secrets.
  • Trigger a manual run via the Actions tab (workflow_dispatch).
  • Confirm the job logs the ::notice::Found N public repos line.
  • Confirm archgate_repo_seen events appear in PostHog live view (one per repo) with populated properties.
  • Build the cumulative unique-users trend and verify it matches the count from the manual run.
  • Wait for the first scheduled run to verify cron fires.

🤖 Generated with Claude Code

Queries the GitHub code-search API once a day for public repos
containing a .archgate/ folder and posts the count, file-match
total, and deduped repo list to PostHog.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Apr 13, 2026

Copy link
Copy Markdown

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: f103bdc
Status: ✅  Deploy successful!
Preview URL: https://0d546174.archgate-cli.pages.dev
Branch Preview URL: https://ci-track-github-adoption.archgate-cli.pages.dev

View logs

rhuanbarreto and others added 3 commits April 14, 2026 01:31
Switches the PostHog payload from a single github_repos_count event
to one archgate_repo_seen event per repo, batched into /batch/.
distinct_id = owner/name so each repo surfaces as a PostHog person
with first-seen / last-seen tracked automatically; $set populates
the person properties (owner, name, full_name, url, is_fork).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
PostHog drops events whose `uuid` matches a previously-ingested one.
Computing uuid5(NAMESPACE_URL, "archgate_repo_seen:{date}:{repo}")
makes a second workflow run on the same UTC day (e.g. manual dispatch
after the cron) a no-op at ingestion — so raw event counts stay clean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds an explicit file_count probe and emits ::warning:: at 800 matches
and ::error:: at 1000. GitHub's code-search API plateaus silently at
1000 results, which would cause the repo set to stop growing without
any visible signal. The annotations turn that into a visible trigger
to add query sharding.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rhuanbarreto rhuanbarreto merged commit a7f9ef9 into main Apr 13, 2026
9 checks passed
@rhuanbarreto rhuanbarreto deleted the ci/track-github-adoption branch April 13, 2026 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant