ci: publish coverage badges to a dedicated branch#300
Open
Kyleasmth wants to merge 6 commits into
Open
Conversation
🦋 Changeset detectedLatest commit: d1ca40f The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
jhampton
requested changes
Jul 22, 2026
jhampton
left a comment
Collaborator
There was a problem hiding this comment.
Greptile feedback and similar idiosyncrasies as the other PR
Collaborator
Author
|
Addressed the feedback here plus the same idiosyncrasies from #95:
Ready for another look when you have a sec. |
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
Applies the test-artifacts pattern from platform-sdk-swift#95 to this repo (YPE-2483). Coverage badge JSON stops being committed to
mainand instead lives on a dedicated orphanbadgesbranch, keepingmain's history clean.What changed
.github/workflows/ci.yml— thetestjob now writes the coverage badge JSON to a scratch dir and publishes it to the orphanbadgesbranch (viaGITHUB_TOKEN) instead of committing.coverage/tomain. Dropped[skip ci]since nothing listens onbadges. Self-seeds the branch if it's ever missing.packages/ui/vitest.config.ts— added acoverageblock with thejson-summaryreporter so the UI package actually emitscoverage-summary.json(core/hooks already did). Without it the UI badge could never render.README.md— added core/hooks/ui coverage badges pointing at thebadgesbranch..gitignore— ignore the.coverage/andcoverage-output/scratch dirs; removed the tracked.coverage/.gitkeep.Notes
badgesbranch is already pre-seeded (mirroring the Swift PR), so badges render immediately with no broken-badge window at merge: core 92.7% 🟢, hooks 90.47% 🟢, ui 79.9% 🟡.mainreceives no commits —badgesis an isolated orphan history containing only the three JSON files.@jhampton — followed your Swift
badges-branch pattern here; tagging you since you filed the ticket. 🙂Test plan
pnpm install --frozen-lockfile,pnpm lint,pnpm typecheck,pnpm testall green under Node 24packages/uinow emitscoverage-summary.jsonci.ymlvalidates as YAMLbadgesbranch seeded; raw endpoint returns HTTP 200mainCI run updates thebadgesbranch and the README badges keep renderingGreptile Summary
This PR migrates coverage badge publishing from committing JSON files to
mainto pushing them onto a dedicated orphanbadgesbranch, keepingmain's history clean. It also adds ajson-summarycoverage reporter topackages/uiso the UI badge can be generated, and adds three shields.io endpoint badges to the README.ci.yml— splits the old single-job approach into atestjob (generates badge JSON, uploads artifact) and a newpublish-coverage-badgesjob (runs only onmain, clones thebadgesbranch, replaces all JSON files atomically, and pushes). Thecontents: writepermission is now scoped only to the publishing job.packages/ui/vitest.config.ts— adds a root-levelcoverageblock (provider: v8,json-summaryreporter,./coverageoutput dir) so the UI package emitscoverage-summary.jsonalongside the other two packages..gitignore/.coverage/.gitkeep— scratch directories are now gitignored and the old tracked placeholder is removed.Confidence Score: 4/5
Safe to merge as-is given the badges branch is already seeded, but the workflow has no recovery path if that branch is ever deleted.
The publish-coverage-badges job hard-requires the badges branch to exist — the checkout step will throw a reference not found error if it is gone, breaking every push to main until someone manually re-creates it. The PR description explicitly promises self-seeding but the implementation does not include it. All other changes are straightforward and low-risk.
publish-coverage-badges job in .github/workflows/ci.yml — the branch checkout has no fallback for a missing badges ref.
Important Files Changed
badgesorphan branch. Clean separation of concerns, but thebadgesbranch checkout will fail hard if the branch is ever deleted — the self-seeding described in the PR description is not implemented.coverageblock withjson-summaryreporter at the roottestconfig level, which is the correct placement for Vitest projects. Coverage output goes to./coverage, matching the path expected by the CI script.badgesbranch — straightforward and correct..coverage/andcoverage-output/ignore entries to keep scratch dirs out ofmain; removes the now-deleted.gitkeep.Sequence Diagram
sequenceDiagram participant PR as Push to main participant TJ as test job participant ART as GitHub Artifacts participant PJ as publish-coverage-badges job participant BB as badges branch PR->>TJ: trigger CI TJ->>TJ: pnpm test:coverage TJ->>TJ: Build badge JSON (core/hooks/ui) TJ->>ART: upload-artifact (coverage-badges) ART-->>PJ: needs: test (main only) PJ->>BB: checkout ref:badges to badges-branch PJ->>ART: download-artifact to coverage-output PJ->>BB: "rm *.json, cp coverage-output/*.json" PJ->>BB: git commit + git pushReviews (5): Last reviewed commit: "Merge branch 'main' into ks/YPE-2483-tes..." | Re-trigger Greptile