Repository navigation
v0.3.0 - Official SDK Backend
What's New
Official SDK Backend Rewrite
All 4 major platforms now use official/vendor SDKs instead of hand-rolled HTTP clients:
| Platform | SDK | Version |
|---|---|---|
| GitHub | google/go-github | v69.2.0 |
| GitLab | gitlab-org/api/client-go | v1.46.0 |
| Gitea | code.gitea.io/sdk/gitea | v0.25.1 |
| Forgejo | forgejo-sdk | v3.0.0 |
| Tencent Code | Hand-written (no SDK available) | - |
New Platform: Forgejo
Added full support for Forgejo (codeberg.org and self-hosted instances), using the official forgejo-sdk v3.
Architecture Changes
- Per-platform file consolidation: Merged 3 files per platform into 1 (e.g.,
github.go+github_extras.go+github_webhook.go→github.go) - Extracted
baseProvider: Shared HTTP client logic for hand-written platforms only - Added
util.go: Shared utilities (parseTotalCount,countDiffLines)
Bug Fixes (from v0.2.0 dev cycle)
- B1: GitHub
CreateBranch()now sends correct{"ref": "refs/heads/<branch>", "sha": "<ref>"}body - B2: Gitea
GetCRDiff()/GetCRFiles()now uses JSON API endpoint instead of raw diff parsing - B3: Tencent Code
GetFileContent()now properly base64-decodes content - B4: GitHub/Gitea
ValidateWebhookSignature()now performs real HMAC-SHA256 verification - B5: GitHub
ListCRs()now supportsSourceBranchfiltering viaheadparameter - B6: Gitea
ListRepos()now respectsOwnerfilter - Tencent Code:
MergeCR()andCloseCR()now implemented via GitLab CE-compatible API
Breaking Changes
NewGiteaProvider()now strips/api/v1suffix from baseURL (SDK adds it automatically)NewForgejoProvider()requires baseURL without/api/v1suffix- Constructor errors no longer panic; instead returns a zero-value provider (callers should check)
Migration from v0.1.0
import sdkprov "github.com/yi-nology/git-platform-sdk/provider"
// Before (v0.1.0)
p := sdkprov.NewProvider(sdkprov.Config{
Platform: sdkprov.PlatformGitHub,
Token: "ghp_xxx",
})
// After (v0.3.0) — same API, new backend
p := sdkprov.NewProvider(sdkprov.Config{
Platform: sdkprov.PlatformForgejo, // ← NEW
BaseURL: "https://codeberg.org", // no /api/v1 suffix
Token: "xxx",
})Stats
- 15 source files → 11 source files
- 5 platforms → 6 platforms
- 31 tests passing
go vetclean