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

Area File(s) Mechanism Keep / migrate
librarystore content push pkg/librarystore/github.go raw git keep (git op)
librarystore repo creation (missing — errors at github.go:135) none migrate → API (#459)
Agent release + asset upload cmd/publish/agent_release.go (:291,:319,:51) gh CLI migrate → API (#457)
GitOps PRs pkg/gitops/publish.go (:1208:1250), observe.go:726 gh CLI migrate → API (#458)
Chore "core behind" issue cmd/status/release.go:266 gh CLI migrate → API (#458)
GitOps branch pushes pkg/gitops/{publish,observe,remote}.go raw git keep (git op)
Release tags cmd/publish/release.go raw git keep (git op)
Version listing cmd/agents/versions.go go-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