1
0
Fork 0
mirror of https://github.com/Luzifer/github2gitea.git synced 2024-12-23 04:21:19 +00:00

Add flag for not migrating forks

This commit is contained in:
Knut Ahlers 2019-07-27 09:55:30 +02:00
parent 3602b68599
commit 1a5272283d
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -26,6 +26,7 @@ var (
GithubToken string `flag:"github-token" default:"" description:"Github access token" validate:"nonzero"` GithubToken string `flag:"github-token" default:"" description:"Github access token" validate:"nonzero"`
LogLevel string `flag:"log-level" default:"info" description:"Log level (debug, info, warn, error, fatal)"` LogLevel string `flag:"log-level" default:"info" description:"Log level (debug, info, warn, error, fatal)"`
MigrateArchived bool `flag:"migrate-archived" default:"false" description:"Create migrations for archived repos"` MigrateArchived bool `flag:"migrate-archived" default:"false" description:"Create migrations for archived repos"`
MigrateForks bool `flag:"migrate-forks" default:"false" description:"Create migrations for forked repos"`
MigratePrivate bool `flag:"migrate-private" default:"true" description:"Migrate private repos (the given Github Token will be entered as sync credential!)"` MigratePrivate bool `flag:"migrate-private" default:"true" description:"Migrate private repos (the given Github Token will be entered as sync credential!)"`
SourceExpression string `flag:"source-expression" default:"" description:"Regular expression to match the full name of the source repo (i.e. '^Luzifer/.*$')" validate:"nonzero"` SourceExpression string `flag:"source-expression" default:"" description:"Regular expression to match the full name of the source repo (i.e. '^Luzifer/.*$')" validate:"nonzero"`
TargetUser int64 `flag:"target-user" default:"0" description:"ID of the User / Organization in Gitea to assign the repo to" validate:"nonzero"` TargetUser int64 `flag:"target-user" default:"0" description:"ID of the User / Organization in Gitea to assign the repo to" validate:"nonzero"`
@ -111,6 +112,11 @@ func fetchGithubRepos() ([]*github.Repository, error) {
continue continue
} }
if !cfg.MigrateForks && boolFromPtr(r.Fork) {
log.WithField("repo", *r.FullName).Debug("Skip: Fork")
continue
}
allRepos = append(allRepos, r) allRepos = append(allRepos, r)
} }