Documentation
¶
Index ¶
- func ReplaceSSHHostname(cloneURL string) string
- func SupportedClients() []string
- func ToSlug(title string) string
- type Bitbucket
- type Client
- type GitLabSnippet
- type Gitea
- type Github
- type Gitlab
- func (c Gitlab) GetGroupRepos(targetGroup string) ([]Repo, error)
- func (c Gitlab) GetOrgRepos(targetOrg string) ([]Repo, error)
- func (c Gitlab) GetSnippets(cloneData []Repo, target string) ([]Repo, error)
- func (c Gitlab) GetTopLevelGroups() ([]string, error)
- func (Gitlab) GetType() string
- func (c Gitlab) GetUserRepos(targetUsername string) ([]Repo, error)
- func (Gitlab) NewClient() (Client, error)
- type Repo
- type RepoCommits
- type ServerProjectResponse
- type ServerRepository
- type Sourcehut
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReplaceSSHHostname ¶
ReplaceSSHHostname replaces the hostname in an SSH clone URL with the custom hostname from GHORG_SSH_HOSTNAME. Only applies to SSH URLs (git@host:...).
func SupportedClients ¶
func SupportedClients() []string
SupportedClients return list of all supported clients
Types ¶
type Bitbucket ¶
type Bitbucket struct {
// extend the bitbucket client
*bitbucket.Client
// contains filtered or unexported fields
}
func (Bitbucket) GetOrgRepos ¶
GetOrgRepos gets org repos
func (Bitbucket) GetUserRepos ¶
GetUserRepos gets user repos from bitbucket
type Client ¶
type Client interface {
NewClient() (Client, error)
GetUserRepos(targetUsername string) ([]Repo, error)
GetOrgRepos(targetOrg string) ([]Repo, error)
GetType() string
}
Client define the interface a scm client has to have
type GitLabSnippet ¶
type Gitea ¶
type Gitea struct {
// extend the gitea client
*gitea.Client
// contains filtered or unexported fields
}
func (Gitea) GetOrgRepos ¶
GetOrgRepos fetches repo data from a specific group with parallel pagination
func (Gitea) GetUserRepos ¶
GetUserRepos gets all of a users gitea repos with parallel pagination
type Github ¶
type Github struct {
// extend the github client
*github.Client
// contains filtered or unexported fields
}
func (Github) GetOrgRepos ¶
GetOrgRepos gets org repos with parallel pagination for performance
func (Github) GetUserGists ¶
GetUserGists gets all gists for a GitHub user
func (Github) GetUserRepos ¶
GetUserRepos gets user repos with parallel pagination for performance
func (Github) SetTokensUsername ¶
func (c Github) SetTokensUsername()
SetTokensUsername sets the GitHub username tied to the github token to the package variable tokenUsername. Then if https clone method is used the clone url will be https://username:token@github.com/org/repo.git The username is now needed when using the new fine-grained tokens for github
type Gitlab ¶
func (Gitlab) GetGroupRepos ¶
GetGroupRepos fetches repo data from a specific group with parallel pagination
func (Gitlab) GetOrgRepos ¶
GetOrgRepos fetches repo data from a specific group
func (Gitlab) GetSnippets ¶
func (Gitlab) GetTopLevelGroups ¶
GetTopLevelGroups all top level org groups with parallel pagination
func (Gitlab) GetUserRepos ¶
GetUserRepos gets all of a users gitlab repos
type Repo ¶
type Repo struct {
// The ID of the repo that is assigned via the SCM provider. This is used for example with gitlab snippets on cloud gropus where we need to know the repo id to look up all he snippets it has.
ID string
// Name is the name of the repo https://www.github.com/blairham/ghorg.git the Name would be ghorg
Name string
// HostPath is the path on the users machine that the repo will be cloned to. Its used in all the git commands to locate the directory of the repo. HostPath is updated for wikis and snippets because the folder for the clone is appended with .wiki and .snippet
HostPath string
// Path where the repo is located within the scm provider. Its mostly used with gitlab repos when the directory structure is preserved. In this case the path becomes where to locate the repo in relation to gitlab.com/group/group/group/repo.git => /group/group/group/repo
Path string
// URL is the web address of the repo
URL string
// CloneURL is the url for cloning the repo, will be different for ssh vs http clones and will have the .git extention
CloneURL string
// CloneBranch the branch to clone. This will be the default branch if not specified. It will always be main for snippets.
CloneBranch string
// IsWiki is set to true when the data is for a wiki page
IsWiki bool
// IsGitHubGist is set to true when the data is for a github gist
IsGitHubGist bool
// IsGitLabSnippet is set to true when the data is for a gitlab snippet
IsGitLabSnippet bool
// IsGitLabRootLevelSnippet is set to true when a snippet was not created for a repo
IsGitLabRootLevelSnippet bool
// GitLabSnippetInfo provides additional information when the thing we are cloning is a gitlab snippet
GitLabSnippetInfo GitLabSnippet
Commits RepoCommits
// SyncedDefaultBranch is set to true when the default branch was successfully synced
SyncedDefaultBranch bool
}
Repo represents an SCM repo, should probably be renamed to "cloneable" since we clone wikis and snippets with this
type RepoCommits ¶
type ServerProjectResponse ¶
type ServerProjectResponse struct {
Values []ServerRepository `json:"values"`
Size int `json:"size"`
IsLastPage bool `json:"isLastPage"`
Start int `json:"start"`
}
type ServerRepository ¶
type ServerRepository struct {
Name string `json:"name"`
Slug string `json:"slug"`
Links map[string]any `json:"links"`
Project struct {
Key string `json:"key"`
} `json:"project"`
}
ServerRepository represents the Bitbucket Server API repository structure
type Sourcehut ¶
func (Sourcehut) GetOrgRepos ¶
GetOrgRepos fetches repo data from a specific group. We emulate this by checking if the repo's owner matches the current user, which is identical to GetUserRepos. It's possible in the future that this will change as the manual (https://docs.sourcehut.org/git.sr.ht/#field-repositories) states that it will. This can be addressed once the changed behaviour is observable, rather than speculative.
func (Sourcehut) GetUserRepos ¶
GetUserRepos gets all of a users sourcehut repos