ci: add daily workflow to track .archgate adoption via PostHog#205
Merged
Conversation
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>
Deploying archgate-cli with
|
| 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 |
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>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.github/workflows/track-adoption.yml) that runs daily at 08:00 UTC.path:.archgate/, dedupes to unique public repos, and emits onearchgate_repo_seenevent 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.$setpopulates the person properties (owner,name,full_name,url,is_fork).workflow_dispatchfor manual runs.How to chart cumulative adoption in PostHog
No ingestion-level dedup needed. Build a Trend insight:
archgate_repo_seenEach 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 withpublic_reposcope. The defaultGITHUB_TOKENis an app-installation token and isn't guaranteed to work against the code-search API.POSTHOG_API_KEY— PostHog Project API Key (the publicphc_...token, not a personal key).Variables (optional)
POSTHOG_HOST— defaults tohttps://eu.i.posthog.com. Set if on US cloud or self-hosted.Caveats
archgate/cliitself counts toward the total since it contains.archgate/. Consistent day-over-day, just noting it.Test plan
GH_SEARCH_TOKENandPOSTHOG_API_KEYsecrets.workflow_dispatch).::notice::Found N public reposline.archgate_repo_seenevents appear in PostHog live view (one per repo) with populated properties.🤖 Generated with Claude Code