Update github scm to know when user is cloning own repos (#201)

This commit is contained in:
Jay Gabriels
2022-04-17 17:51:53 -07:00
committed by GitHub
parent 706cabfb5c
commit da4ac382bc
4 changed files with 21 additions and 4 deletions

View File

@@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
## [1.7.13] - unreleased
## [1.7.14] - Unreleased
### Added
### Changed
### Deprecated
@@ -11,6 +11,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
### Fixed
### Security
## [1.7.13] - 4/17/22
### Added
### Changed
### Deprecated
### Removed
### Fixed
- User cloning self on github now finds all public/private repos; thanks @iDoka
### Security
## [1.7.12] - 5/19/22
### Added
- Dockerfile

View File

@@ -422,7 +422,7 @@ func CloneAllRepos(git git.Gitter, cloneTargets []scm.Repo) {
os.Exit(1)
}
colorlog.PrintInfo("Using ghorgignore, filtering repos down...\n")
colorlog.PrintInfo("\nUsing ghorgignore, filtering repos down...\n")
filteredCloneTargets := []scm.Repo{}
var flag bool

View File

@@ -11,6 +11,6 @@ var versionCmd = &cobra.Command{
Short: "Print the version number of Ghorg",
Long: `All software has versions. This is Ghorg's`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("v1.7.12")
fmt.Println("v1.7.13")
},
}

View File

@@ -53,7 +53,7 @@ func (c Github) GetOrgRepos(targetOrg string) ([]Repo, error) {
}
if opt.Page%12 == 0 && opt.Page != 0 {
colorlog.PrintSubtleInfo("Everything is okay, its just a lot of repos...")
colorlog.PrintSubtleInfo("\nEverything is okay, the org just has a lot of repos...")
}
opt.Page = resp.NextPage
}
@@ -63,6 +63,14 @@ func (c Github) GetOrgRepos(targetOrg string) ([]Repo, error) {
// GetUserRepos gets user repos
func (c Github) GetUserRepos(targetUser string) ([]Repo, error) {
userToken, _, _ := c.Users.Get(context.Background(), "")
if targetUser == userToken.GetLogin() {
colorlog.PrintSubtleInfo("\nCloning all your public/private repos. This process may take a bit longer than other clones, please be patient...")
targetUser = ""
}
if os.Getenv("GHORG_SCM_BASE_URL") != "" {
c.BaseURL, _ = url.Parse(os.Getenv("GHORG_SCM_BASE_URL"))
}