@@ -47,13 +47,14 @@ func (f *GithubDownloaderV3Factory) New(ctx context.Context, opts base.MigrateOp
4747 return nil , err
4848 }
4949
50+ baseURL := u .Scheme + "://" + u .Host
5051 fields := strings .Split (u .Path , "/" )
5152 oldOwner := fields [1 ]
5253 oldName := strings .TrimSuffix (fields [2 ], ".git" )
5354
5455 log .Trace ("Create github downloader: %s/%s" , oldOwner , oldName )
5556
56- return NewGithubDownloaderV3 (ctx , opts .AuthUsername , opts .AuthPassword , opts .AuthToken , oldOwner , oldName ), nil
57+ return NewGithubDownloaderV3 (ctx , baseURL , opts .AuthUsername , opts .AuthPassword , opts .AuthToken , oldOwner , oldName ), nil
5758}
5859
5960// GitServiceType returns the type of git service
@@ -74,7 +75,7 @@ type GithubDownloaderV3 struct {
7475}
7576
7677// NewGithubDownloaderV3 creates a github Downloader via github v3 API
77- func NewGithubDownloaderV3 (ctx context.Context , userName , password , token , repoOwner , repoName string ) * GithubDownloaderV3 {
78+ func NewGithubDownloaderV3 (ctx context.Context , baseURL , userName , password , token , repoOwner , repoName string ) * GithubDownloaderV3 {
7879 var downloader = GithubDownloaderV3 {
7980 userName : userName ,
8081 password : password ,
@@ -98,6 +99,9 @@ func NewGithubDownloaderV3(ctx context.Context, userName, password, token, repoO
9899 client = oauth2 .NewClient (downloader .ctx , ts )
99100 }
100101 downloader .client = github .NewClient (client )
102+ if baseURL != "https://github.com" {
103+ downloader .client , _ = github .NewEnterpriseClient (baseURL , baseURL , client )
104+ }
101105 return & downloader
102106}
103107
0 commit comments