Uh oh!
There was an error while loading. Please reload this page.
refactor: migrate GitOps PR + chore-issue flows to go-github (#458) - #463
Merged
antoinetoussaint-byte merged 4 commits intoAug 23, 2026
Merged
Conversation
…458) Replace the `gh pr list/create/edit/view` and `gh issue create` shell-outs with go-github REST calls, and extract a shared `pkg/github` client/token helper reused by cmd/agents, pkg/gitops and cmd/status. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The review-decision gate in observeReview was migrated to a REST-derived approval check. GitHub's reviewDecision is a GraphQL-computed field that folds in branch-protection required-approval counts and CODEOWNERS; a REST ">=1 approval, no change request" derivation cannot see those. A promotion PR with a single non-required approval, merged via admin/maintainer bypass, would derive APPROVED and pass the deploy-authorization gate that the old `gh pr view --json reviewDecision` correctly rejected. Revert observe.go to gh — reviewDecision has no faithful REST equivalent. Add tests for the PR update path in openOrUpdatePullRequest (existing open promotion is edited; head-commit drift is rejected), which the go-github migration previously left uncovered. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
golangci-lint flagged two new issues from the go-github migration: - gosec G702 on the `git remote get-url` call in agentRepository: git runs with fixed subcommands and a scanned filesystem path as an argument (no shell), so annotate with //nolint:gosec matching the pkg/librarystore precedent. - govet shadow: the PullRequests.Edit error redeclared the outer `err`; rename it to editErr. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ops-pr-chore-issue-flows-from-gh # Conflicts: # cmd/agents/versions.go
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Aug 23, 2026
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 freeto 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.
Closes#458.
Summary
gh pr list/create/edit+ PR-view verification (pkg/gitops/publish.go) andgh issue create(cmd/status/release.go) shell-outs withgithub.com/google/go-github/v89REST calls, so those PR/issue operations no longer depend on theghbinary and share one client's error/rate-limit behavior.cmd/agents/versions.gointo a sharedpkg/github(NewClient+Token), now reused bycmd/agents,pkg/gitops, andcmd/status— not a third copy.NewClienthonorsGITHUB_API_URL(GitHub Actions / Enterprise), which also gives tests a clean HTTP seam.gitCommandgit binary and are untouched.Deviation from the issue:
observe.gostays onghThe issue lists
observeReview'sgh pr view(pkg/gitops/observe.go) as a migration target. It is deliberately not migrated.observeReviewgates deploy authorization on GitHub'sreviewDecision, a GraphQL-computed field that folds in branch-protection required-approval counts and CODEOWNERS.PullRequests.Get(REST) does not expose it, and deriving it from the REST review list (">=1 approval, no outstanding change request") silently weakens the gate: a promotion PR with a single non-required approval, merged via admin/maintainer bypass, would deriveAPPROVEDand pass a gate thatgh pr view --json reviewDecisioncorrectly rejects. Since a faithful REST equivalent does not exist, this path keepsgh(consistent with the #460 umbrella decision). The remainingghPR/issue shell-outs are eliminated.Test plan
go build ./...go vet ./pkg/github/... ./pkg/gitops/... ./cmd/agents/... ./cmd/status/...go test ./pkg/github/... ./pkg/gitops/... ./cmd/agents/... ./cmd/status/...pkg/githubclient tests (auth header, unauthenticated,GITHUB_API_URLendpoint)openOrUpdatePullRequest: existing PR edited, head-commit drift rejected) driven by an httptest GitHub server instead of a fakeghbinarycmd/statuschore-issue creation + remote parsing tests🤖 Generated with Claude Code