Skip to content

Migrate GitOps PR + chore-issue flows from gh CLI to go-github API #458

Description

@antoinetoussaint-byte

Summary

The GitOps promotion flow and the "core is behind" chore-issue flow shell out to the gh CLI for pull-request and issue operations. These are pure GitHub REST API calls; move them to github.com/google/go-github/v89 (already a direct dependency, go.mod:22).

Lower priority than the agent-release migration (#457) because these paths run in developer/CI contexts where gh is more reliably present — but consolidating onto one client removes the last hard gh dependencies and makes error handling/rate-limit behavior consistent.

What uses gh today

Pull requests — pkg/gitops/publish.go:

  • gh pr list (:1208)
  • gh pr edit (:1230)
  • gh pr create (:1236)
  • gh pr viewverifyPullRequest (:1250)

PR reads — pkg/gitops/observe.go:

  • gh pr view (:726)

Chore issue — cmd/status/release.go:

  • gh issue create (:266) — opens the "core is behind" issue.

Proposed change

Replace with go-github calls, reusing the shared client/token helper (see #457 — ideally a pkg/github with newGitHubClient + githubToken):

  • gh pr listclient.PullRequests.List (filter by head/base/state)
  • gh pr createclient.PullRequests.Create
  • gh pr editclient.PullRequests.Edit
  • gh pr viewclient.PullRequests.Get
  • gh issue createclient.Issues.Create

Note — keep git for git

pkg/gitops/publish.go / observe.go / remote.go also push branches via the gitCommand git shell-out (clone, clone --mirror, push --porcelain). Those are genuine git operations and should stay on the git binary — this issue only covers the PR/issue API calls.

Acceptance

  • PR list/create/edit/view and chore-issue creation go through go-github, no gh pr * / gh issue * shell-outs.
  • git branch pushes untouched (still gitCommand).
  • Shared client/token helper reused (not a third copy of the plumbing).

Part of #460.

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