diff options
| author | Paul Buetow <paul@buetow.org> | 2025-06-23 23:26:52 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-06-23 23:26:52 +0300 |
| commit | 006724744a943aad877a92406a5e2b4d5d12acd3 (patch) | |
| tree | ce79e6481d3a9ae38bebf3a7acd1d3a7edd520a8 /internal/config | |
| parent | 125e2a2c50bcb3eaa5dfb8802c6de3b2f406b3d2 (diff) | |
Add GitHub repository creation and improve error handling
- Add --create-github-repos flag to automatically create missing GitHub repositories
- Implement GitHub API client with token support from config/env/file
- Add Codeberg API integration to sync all public repositories
- Make sync operations stop on first error for better debugging
- Support GitHub repo creation for all sync commands (--sync, --sync-all, --sync-codeberg-public)
- Add comprehensive error messages and debug logging
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'internal/config')
| -rw-r--r-- | internal/config/config.go | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index 754e226..1bfcedc 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -10,8 +10,9 @@ import ( // Organization represents a git organization with its host and name type Organization struct { - Host string `json:"host"` - Name string `json:"name"` + Host string `json:"host"` + Name string `json:"name"` + GitHubToken string `json:"github_token,omitempty"` } // Config holds the application configuration @@ -83,4 +84,35 @@ func (c *Config) FindOrganization(host string) *Organization { } } return nil -}
\ No newline at end of file +} + +// IsCodeberg checks if the organization is Codeberg +func (o *Organization) IsCodeberg() bool { + return o.Host == "git@codeberg.org" || strings.Contains(o.Host, "codeberg.org") +} + +// FindCodebergOrg finds the first Codeberg organization +func (c *Config) FindCodebergOrg() *Organization { + for i := range c.Organizations { + if c.Organizations[i].IsCodeberg() { + return &c.Organizations[i] + } + } + return nil +} + +// IsGitHub checks if the organization is GitHub +func (o *Organization) IsGitHub() bool { + return o.Host == "git@github.com" || strings.Contains(o.Host, "github.com") +} + +// FindGitHubOrg finds the first GitHub organization +func (c *Config) FindGitHubOrg() *Organization { + for i := range c.Organizations { + if c.Organizations[i].IsGitHub() { + return &c.Organizations[i] + } + } + return nil +} + |
