Skip to content

GitHub integration: standardize on go-github API for platform ops, git for content #460

Description

@antoinetoussaint-byte

Summary

We interact with GitHub through three different mechanisms today — the gh CLI, raw git, and the go-github API — with no clear rule for which to use. This umbrella tracks aligning on a single principle and migrating the mismatched call sites.

Guiding principle

Use git for git operations; use the go-github API for GitHub platform operations. The gh CLI is only a thin API wrapper in a subprocess — it adds a runtime binary + auth dependency and inconsistent error handling for no benefit over the API client we already vendor.

  • Content operations (clone / add / commit / tag / push / ls-remote / ls-files)git binary. The REST API is slower and lossier here; reimplementing git over HTTP is a step backwards. Keep as-is.
  • Platform operations (create repo / release / upload asset / PR / issue)go-github. These are not git; they're API calls currently shelled through gh.

Key fact: no new dependency

github.com/google/go-github/v89 is already a direct dependency (go.mod:22), used read-only today in cmd/agents/versions.go (newGitHubClient:488, ListReleases/ListTags). Token plumbing already exists in githubToken() (:500): GITHUB_TOKEN / GH_TOKEN, falling back to gh auth token (credential-only use of gh, which is fine).

Suggested first step: lift newGitHubClient + githubToken into a shared pkg/github helper so every migration reuses one client + token path.

Where each mechanism is used today

AreaFile(s)MechanismKeep / migrate
librarystore content pushpkg/librarystore/github.goraw gitkeep (git op)
librarystore repo creation(missing — errors at github.go:135)nonemigrate → API (#459)
Agent release + asset uploadcmd/publish/agent_release.go (:291,:319,:51)gh CLImigrate → API (#457)
GitOps PRspkg/gitops/publish.go (:1208:1250), observe.go:726gh CLImigrate → API (#458)
Chore "core behind" issuecmd/status/release.go:266gh CLImigrate → API (#458)
GitOps branch pushespkg/gitops/{publish,observe,remote}.goraw gitkeep (git op)
Release tagscmd/publish/release.goraw gitkeep (git op)
Version listingcmd/agents/versions.gogo-github ✅already correct

Work items

Non-goals

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgoPull requests that update go codeimprovement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions