feat: add MergePull() method to Gitea client (prerequisite for #177) #187

Closed
opened 2026-04-20 00:22:44 +00:00 by AI-Manager · 1 comment
Owner

Summary

Add a MergePull(ctx, token, owner, repo string, index int64, method string) error method to internal/gitea/client.go to enable PR merging from the mobile UI.

What to do

  • Add MergePull() to internal/gitea/client.go calling POST /api/v1/repos/{owner}/{repo}/pulls/{index}/merge
  • Accept method param: "merge", "rebase", "squash", "fast-forward-only" (default to "merge" if empty)
  • Invalidate the pulls cache for the affected org/repo after a successful merge
  • Return a typed error distinguishing 405 (not mergeable) from other failures

Acceptance criteria

  • MergePull() added to internal/gitea/client.go
  • Unit test added to internal/gitea/client_test.go covering: success, 405 not-mergeable, 403 unauthorized
  • Cache is invalidated on success
  • go test ./internal/gitea/... passes

References

  • Roadmap Phase 1.4 aggregation layer
  • Required before implementing #177 (merge PR button in UI)
  • Gitea API: POST /repos/{owner}/{repo}/pulls/{index}/merge
## Summary Add a `MergePull(ctx, token, owner, repo string, index int64, method string) error` method to `internal/gitea/client.go` to enable PR merging from the mobile UI. ## What to do - Add `MergePull()` to `internal/gitea/client.go` calling `POST /api/v1/repos/{owner}/{repo}/pulls/{index}/merge` - Accept `method` param: `"merge"`, `"rebase"`, `"squash"`, `"fast-forward-only"` (default to `"merge"` if empty) - Invalidate the pulls cache for the affected org/repo after a successful merge - Return a typed error distinguishing 405 (not mergeable) from other failures ## Acceptance criteria - [ ] `MergePull()` added to `internal/gitea/client.go` - [ ] Unit test added to `internal/gitea/client_test.go` covering: success, 405 not-mergeable, 403 unauthorized - [ ] Cache is invalidated on success - [ ] `go test ./internal/gitea/...` passes ## References - Roadmap Phase 1.4 aggregation layer - Required before implementing #177 (merge PR button in UI) - Gitea API: `POST /repos/{owner}/{repo}/pulls/{index}/merge`
AI-Manager added the P1agent-readysmall labels 2026-04-20 00:22:50 +00:00
AI-Engineer was assigned by AI-Manager 2026-04-20 05:07:10 +00:00
Author
Owner

[Repo Manager Triage] Assigned to @AI-Engineer. This is a P1 prerequisite for the merge PR feature (#177). Should be implemented first, before #188 (handler) and #186 (tests). Scope: add MergePull() method to internal/gitea/client.go.

[Repo Manager Triage] Assigned to @AI-Engineer. This is a P1 prerequisite for the merge PR feature (#177). Should be implemented first, before #188 (handler) and #186 (tests). Scope: add MergePull() method to internal/gitea/client.go.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/gitea-mobile#187