feat(landing): hero GitHub star badge + shared build-time star fetch (plan 68) by duyet · Pull Request #2228 · chmonitor/chmonitor · GitHub
Skip to content

feat(landing): hero GitHub star badge + shared build-time star fetch (plan 68) - #2228

Merged
duyet merged 1 commit into
mainfrom
advisor/68-github-star-social-proof
Jul 3, 2026
Merged

feat(landing): hero GitHub star badge + shared build-time star fetch (plan 68)#2228
duyet merged 1 commit into
mainfrom
advisor/68-github-star-social-proof

Conversation

@duyet

@duyet duyet commented Jul 3, 2026

Copy link
Copy Markdown
Member

What (plan 68 — GitHub star social proof)

Adds a star-count CTA to the hero and wires click tracking on the star CTAs, reconciling with the star fetch SocialProof.astro already does rather than duplicating it.

  • lib/github-stars.ts (new) — extracts the build-time GitHub stargazers_count fetch into a shared, memoized helper so the static build makes one API call, consumed by both the hero badge and the community card. Fails open: on offline/rate-limited/non-200, counts are null.
  • Hero.astro — the plain "GitHub" button becomes a "★ Star {count}" badge with a reserved-width count (data-cta="github-star-hero"). When the fetch returns no count it renders "Star" with no fabricated number.
  • SocialProof.astro — now consumes the shared helper (removed its inline duplicate fetch); star chip gets data-cta="github-star-community".
  • Click tracking uses the existing data-cta delegation in Base.astro → allowlisted cta_click event (DNT-respecting) — no new analytics event type added.
  • github-stars.test.ts (new) + a test script for the landing package: covers the fail-open invariant (throw/non-200 → null, never a fake count) and count formatting.

Reconciliation note (STOP/DRIFT)

The plan's STOP condition says reconcile if a star count already exists — it did (SocialProof.astro). So this shares that one data path and adds only the missing hero badge + tracking, instead of a second fetch/duplicate card. OpenSource.astro is not mounted in index.astro, so the mid-page card stays in SocialProof.

Verification

  • cd apps/landing && bun run build — green (5 pages); built HTML contains both github-star-hero and github-star-community CTAs.
  • bun test apps/landing/src/lib/github-stars.test.ts — 7 pass.
  • bun run check (whole repo) — clean, no format drift. Pre-push (891 unit/package tests) green.

Risk

Additive marketing-only; no app/runtime/billing/security change. Honest-marketing invariant held (real count or none).

Co-Authored-By: duyetbot bot@duyet.net

…(plan 68)

Add a star-count CTA to the hero, reusing SocialProof's build-time GitHub fetch
instead of duplicating it: extract the fetch into a shared, memoized
lib/github-stars.ts (one API call per build), consumed by both the hero badge
and the community card. Clicks are tracked via the existing data-cta delegation
(github-star-hero / github-star-community) — no new analytics event. Fails open:
when the build-time fetch returns no count, the badge renders "Star" with no
fabricated number. Unit test covers the fail-open + formatting invariants.

Co-Authored-By: duyetbot <bot@duyet.net>
@github-actions github-actions Bot added the dependencies Pull requests that update a dependency file label Jul 3, 2026
@duyet
duyet enabled auto-merge (squash) July 3, 2026 11:38
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

@duyet
duyet merged commit 179d69f into main Jul 3, 2026
15 checks passed
@duyet
duyet deleted the advisor/68-github-star-social-proof branch July 3, 2026 11:38
@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant