mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-10-22 04:06:54 +00:00
Merge pull request #75 from floatdrop/github-enterprise-support
GitHub Enterprise Support
This commit is contained in:
@@ -12,7 +12,6 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
HostGithub = "github.com"
|
||||
HostBitbucket = "bitbucket.org"
|
||||
HostGoogle = "code.google.com"
|
||||
HostCustom = "custom"
|
||||
@@ -25,8 +24,8 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
githubRepoPattern = "git://github.com/%s/%s.git"
|
||||
githubRepoPatternPrivate = "git@github.com:%s/%s.git"
|
||||
githubRepoPattern = "git://%s/%s/%s.git"
|
||||
githubRepoPatternPrivate = "git@%s:%s/%s.git"
|
||||
bitbucketRepoPattern = "https://bitbucket.org/%s/%s.git"
|
||||
bitbucketRepoPatternPrivate = "git@bitbucket.org:%s/%s.git"
|
||||
)
|
||||
@@ -122,15 +121,15 @@ func NewRepo(host, owner, name, scm, url string) (*Repo, error) {
|
||||
}
|
||||
|
||||
// Creates a new GitHub repository
|
||||
func NewGitHubRepo(owner, name string, private bool) (*Repo, error) {
|
||||
func NewGitHubRepo(domain, owner, name string, private bool) (*Repo, error) {
|
||||
var url string
|
||||
switch private {
|
||||
case false:
|
||||
url = fmt.Sprintf(githubRepoPattern, owner, name)
|
||||
url = fmt.Sprintf(githubRepoPattern, domain, owner, name)
|
||||
case true:
|
||||
url = fmt.Sprintf(githubRepoPatternPrivate, owner, name)
|
||||
url = fmt.Sprintf(githubRepoPatternPrivate, domain, owner, name)
|
||||
}
|
||||
return NewRepo(HostGithub, owner, name, ScmGit, url)
|
||||
return NewRepo(domain, owner, name, ScmGit, url)
|
||||
}
|
||||
|
||||
// Creates a new Bitbucket repository
|
||||
@@ -142,7 +141,7 @@ func NewBitbucketRepo(owner, name string, private bool) (*Repo, error) {
|
||||
case true:
|
||||
url = fmt.Sprintf(bitbucketRepoPatternPrivate, owner, name)
|
||||
}
|
||||
return NewRepo(HostGithub, owner, name, ScmGit, url)
|
||||
return NewRepo(HostBitbucket, owner, name, ScmGit, url)
|
||||
}
|
||||
|
||||
func (r *Repo) DefaultBranch() string {
|
||||
|
@@ -17,6 +17,8 @@ type Settings struct {
|
||||
// GitHub Consumer key and secret.
|
||||
GitHubKey string `meddler:"github_key"`
|
||||
GitHubSecret string `meddler:"github_secret"`
|
||||
GitHubDomain string `meddler:"github_domain"`
|
||||
GitHubApiUrl string `meddler:"github_apiurl"`
|
||||
|
||||
// Bitbucket Consumer Key and secret.
|
||||
BitbucketKey string `meddler:"bitbucket_key"`
|
||||
|
Reference in New Issue
Block a user