feat: add Gitea forge support alongside GitHub
Implements the Forge interface for Gitea instances (tested against git.catlow.cloud, Gitea v1.26.4). The forge.New factory now dispatches on forge type, and config validation accepts 'gitea'. Changes: - internal/forge/gitea.go — GiteaClient implementing all 11 Forge methods: issue polling (assigned + label), comments, PR creation, PR state reconciliation, issue closure, reactions, state labels, push verification. Handles edge cases: not-found PRs return 'closed', GetUserByName errors from the Gitea SDK are mapped to user-friendly messages. - internal/forge/forge.go — New() factory dispatching on forge type (github/gitea). GitHub constructor renamed to NewGitHub. - internal/forge/github_test.go — updated to use New() signature - internal/config/config.go — forge.type accepts 'gitea', BotEmail defaults change per forge type (gitea uses @gitea.local) - cmd/archied/main.go — passes cfg.Forge.Type to forge.New() Dependencies: added code.gitea.io/sdk/gitea v0.25.1 End-to-end verified against live Gitea instance: daemon starts clean, registry built (5 workflows), web UI listening, no errors or warnings.
This commit is contained in:
1 parent
2f4ca5be60
commit
edd05aea6b
8 files changed
+371
-12
No files matched your search
@@ -23,9 +23,9 @@ type GitHubClient struct {
|
||||
labelsEnsured map[string]bool
|
||||
}
|
||||
|
||||
// New creates a GitHub-backed Forge implementation. Non-github.com hosts
|
||||
// are configured using GitHub Enterprise's API and upload URL conventions.
|
||||
func New(token, host string, log *slog.Logger) (Forge, error) {
|
||||
// NewGitHub creates a GitHub-backed Forge implementation. Non-github.com
|
||||
// hosts are configured using GitHub Enterprise's API and upload URL conventions.
|
||||
func NewGitHub(token, host string, log *slog.Logger) (Forge, error) {
|
||||
client := github.NewClient(nil)
|
||||
if strings.TrimRight(host, "/") != "https://github.com" {
|
||||
var err error
|
||||
|
||||
Reference in new issue
Block a user