Skip to content

feat: standardize GitHub platform ops on go-github, keep git for content (#460) - #464

Closed
antoinetoussaint-byte wants to merge 2 commits into
mainfrom
issue-460-github-integration-standardize-on-go-github-api-for
Closed

feat: standardize GitHub platform ops on go-github, keep git for content (#460)#464
antoinetoussaint-byte wants to merge 2 commits into
mainfrom
issue-460-github-integration-standardize-on-go-github-api-for

Conversation

@antoinetoussaint-byte

@antoinetoussaint-byteantoinetoussaint-byte commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Closes#460.
Closes#459.

Summary

Aligns GitHub integration on one principle: git for content operations, the go-github API for platform operations. This is the remainder of #460 after #457's agent-release migration landed separately in #462 — reconciled onto the shared pkg/gh helper that #462 introduced (rather than the separate pkg/github this branch originally added, which would have duplicated the client/token path and collided with the github import name).

No new dependency — github.com/google/go-github/v89 was already direct.

What moved to the API

Call siteBeforeAfter
pkg/gitops/publish.go — promotion PRgh pr list/create/edit/viewPullRequests.List/Create/Edit/Get
cmd/status/release.go — chore issuegh issue createIssues.Create
pkg/librarystore/github.go — repo creation gaperrored: "create the repo first"Repositories.Get then Create when missing (content publish stays on git)

pkg/gh gains RepoAtDir/ParseRemote (owner/repo from the origin remote) alongside the existing NewClient/Token/Owner.

Note: the agent-release publishing migration (cmd/publish/agent_release.go, cmd/agents/versions.go) and the shared helper originally in this branch were merged ahead of this in #462 (closes#457). This branch was rebased onto that result: the superseded parts were dropped and every remaining call site now reuses pkg/gh.

Deliberately kept on gh / git

  • pkg/gitops/observe.go still uses gh pr view for the promotion gate: it reads reviewDecision, a GraphQL-only field with no go-github REST equivalent. Deriving it from REST review lists would weaken a security gate (it would ignore required-reviewer / CODEOWNERS policy), so this read stays as-is.
  • All git content ops (clone/add/commit/tag/push/ls-remote/ls-files) stay on the git binary.
  • The gh auth token credential fallback stays — a convenience, not a hard dependency.

Test plan

  • go build ./..., go vet, gofmt clean
  • go test ./pkg/gh/... ./pkg/gitops/... ./cmd/status/... ./pkg/librarystore/... ./cmd/publish/... ./cmd/agents/...
  • New pkg/ghParseRemote cases (HTTPS/SSH/ssh://, trailing slash, non-github.com host rejected)
  • Promotion-PR, chore-issue, and library-repo-creation tests drive the go-github flow against a local httptest server via the newGitHubClient seam

🤖 Generated with Claude Code

@antoinetoussaint-byte
antoinetoussaint-byteforce-pushed the issue-460-github-integration-standardize-on-go-github-api-for branch from 1e7a889 to d7ea96aCompareAugust 23, 2026 21:56
Completes the go-github standardization for the platform (REST API)
operations that #457 (agent-release publishing, merged in #462) did not
cover, reconciled onto the shared pkg/gh helper that #462 introduced
rather than the separate pkg/github this work originally added:
- pkg/gitops/publish.go: promotion pull-request list/create/edit/verify
move from `gh pr *` to PullRequests.List/Create/Edit/Get.
- cmd/status/release.go: chore issue creation moves from `gh issue
create` to Issues.Create.
- pkg/librarystore/github.go: a first-ever library publish now creates
the target repo via Repositories.Get-then-Create when the clone fails,
instead of erroring; content publishing stays on git.
- pkg/gh: gains RepoAtDir/ParseRemote (owner/repo from the origin
remote) alongside the existing NewClient/Token/Owner.
Deliberately unchanged: pkg/gitops/observe.go still reads reviewDecision
through `gh` — a GraphQL-only field with no REST equivalent; deriving it
from REST review lists would weaken the promotion security gate. Git
content ops (clone/add/commit/tag/push) stay on the git binary.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@antoinetoussaint-byte
antoinetoussaint-byteforce-pushed the issue-460-github-integration-standardize-on-go-github-api-for branch from d7ea96a to 230376fCompareAugust 23, 2026 22:03
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@antoinetoussaint-byte

Copy link
Copy Markdown
ContributorAuthor

Superseded — closing without merging.

The #460 umbrella work landed on main as three separate PRs while this branch was being reconciled:

main now has every migrated call site off the gh CLI (verified: no gh release/pr/issue shell-outs remain in agent_release.go, versions.go, gitops/publish.go, status/release.go, librarystore/github.go), with gitops/observe.go deliberately still on gh pr view for the GraphQL-only reviewDecision. This branch is now a divergent reimplementation of that merged work — merging it would conflict with and partially revert #463/#461 — so it is closed as redundant rather than merged.

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

Labels

None yet

Projects

None yet

1 participant

@antoinetoussaint-byte