mirror of
https://github.com/cooperspencer/gickup.git
synced 2025-05-10 17:25:34 +02:00
implemented exclude forks (#155)
This commit is contained in:
parent
2bc4aa432a
commit
64a67254e6
8 changed files with 59 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,3 +4,4 @@ gickup
|
|||
conf.yml
|
||||
.idea
|
||||
dist/
|
||||
.vscode
|
|
@ -33,6 +33,7 @@ source:
|
|||
languages: # only clone repositories with the following languages
|
||||
- go
|
||||
- java
|
||||
excludeforks: true # exclude forked repositories
|
||||
gitea:
|
||||
- token: some-token
|
||||
# token_file: token.txt # alternatively, specify token in a file
|
||||
|
@ -67,6 +68,7 @@ source:
|
|||
languages: # only clone repositories with the following languages
|
||||
- go
|
||||
- java
|
||||
excludeforks: true # exclude forked repositories
|
||||
gogs:
|
||||
- token: some-token
|
||||
# token_file: token.txt # alternatively, specify token in a file
|
||||
|
@ -96,6 +98,7 @@ source:
|
|||
filter:
|
||||
stars: 100 # only clone repos with 100 stars
|
||||
lastactivity: 1y # only clone repos which had activity during the last year
|
||||
excludeforks: true # exclude forked repositories
|
||||
gitlab:
|
||||
- token: some-token
|
||||
# token_file: token.txt # alternatively, specify token in a file
|
||||
|
@ -123,6 +126,14 @@ source:
|
|||
- bar1
|
||||
wiki: true # includes wiki too
|
||||
starred: true # includes the user's starred repositories too
|
||||
filter:
|
||||
stars: 100 # only clone repos with 100 stars
|
||||
lastactivity: 1y # only clone repos which had activity during the last year
|
||||
excludearchived: true
|
||||
languages: # only clone repositories with the following languages
|
||||
- go
|
||||
- java
|
||||
excludeforks: true # exclude forked repositories
|
||||
bitbucket:
|
||||
- user: some-user # the user you want to clone the repositories from.
|
||||
url: http(s)://url-to-bitbucket # if empty, it uses https://bitbucket.org
|
||||
|
@ -151,6 +162,7 @@ source:
|
|||
- foobar
|
||||
filter:
|
||||
lastactivity: 1y # only clone repos which had activity during the last year
|
||||
excludeforks: true # exclude forked repositories
|
||||
sourcehut:
|
||||
- token: some-token
|
||||
# token_file: token.txt # alternatively, specify token in a file
|
||||
|
|
|
@ -262,6 +262,11 @@ func Get(conf *types.Conf) ([]types.Repo, bool) {
|
|||
languages := types.GetMap(repo.Filter.Languages)
|
||||
|
||||
for _, r := range gitearepos {
|
||||
if repo.Filter.ExcludeForks {
|
||||
if r.Fork {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if repo.Filter.ExcludeArchived {
|
||||
if r.Archived {
|
||||
continue
|
||||
|
@ -404,6 +409,11 @@ func Get(conf *types.Conf) ([]types.Repo, bool) {
|
|||
}
|
||||
}
|
||||
for _, r := range orgrepos {
|
||||
if repo.Filter.ExcludeForks {
|
||||
if r.Fork {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if repo.Filter.ExcludeArchived {
|
||||
if r.Archived {
|
||||
continue
|
||||
|
|
|
@ -227,6 +227,11 @@ func Get(conf *types.Conf) ([]types.Repo, bool) {
|
|||
languages := types.GetMap(repo.Filter.Languages)
|
||||
|
||||
for _, r := range githubrepos {
|
||||
if repo.Filter.ExcludeForks {
|
||||
if *r.Fork {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if repo.Filter.ExcludeArchived {
|
||||
if r.Archived != nil {
|
||||
if *r.Archived {
|
||||
|
|
|
@ -190,6 +190,11 @@ func Get(conf *types.Conf) ([]types.Repo, bool) {
|
|||
languages := types.GetMap(repo.Filter.Languages)
|
||||
|
||||
for _, r := range gitlabrepos {
|
||||
if repo.Filter.ExcludeForks {
|
||||
if r.ForkedFromProject != nil {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if repo.Filter.ExcludeArchived {
|
||||
if r.Archived {
|
||||
continue
|
||||
|
@ -355,6 +360,11 @@ func Get(conf *types.Conf) ([]types.Repo, bool) {
|
|||
}
|
||||
for k, gr := range gitlabgrouprepos {
|
||||
for _, r := range gr {
|
||||
if repo.Filter.ExcludeForks {
|
||||
if r.ForkedFromProject != nil {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if repo.Filter.ExcludeArchived {
|
||||
if r.Archived {
|
||||
continue
|
||||
|
|
10
gogs/gogs.go
10
gogs/gogs.go
|
@ -181,6 +181,11 @@ func Get(conf *types.Conf) ([]types.Repo, bool) {
|
|||
excludeorgs := types.GetMap(repo.ExcludeOrgs)
|
||||
|
||||
for _, r := range gogsrepos {
|
||||
if repo.Filter.ExcludeForks {
|
||||
if r.Fork {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if r.Stars < repo.Filter.Stars {
|
||||
continue
|
||||
}
|
||||
|
@ -306,6 +311,11 @@ func Get(conf *types.Conf) ([]types.Repo, bool) {
|
|||
}
|
||||
}
|
||||
for _, r := range orgrepos {
|
||||
if repo.Filter.ExcludeForks {
|
||||
if r.Fork {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if r.Stars < repo.Filter.Stars {
|
||||
continue
|
||||
}
|
||||
|
|
|
@ -84,6 +84,11 @@ func Get(conf *types.Conf) ([]types.Repo, bool) {
|
|||
}
|
||||
|
||||
for _, r := range userrepos {
|
||||
if repo.Filter.ExcludeForks {
|
||||
if r.ForkedFromID != 0 {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if len(repo.Include) > 0 {
|
||||
if !include[r.Name] {
|
||||
continue
|
||||
|
@ -178,6 +183,11 @@ func Get(conf *types.Conf) ([]types.Repo, bool) {
|
|||
}
|
||||
|
||||
for _, r := range orgrepos {
|
||||
if repo.Filter.ExcludeForks {
|
||||
if r.ForkedFromID != 0 {
|
||||
continue
|
||||
}
|
||||
}
|
||||
urls, err := client.GetCloneUrl(r.ID)
|
||||
if err != nil {
|
||||
log.Error().
|
||||
|
|
|
@ -255,6 +255,7 @@ type Filter struct {
|
|||
Stars int `yaml:"stars"`
|
||||
Languages []string `yaml:"languages"`
|
||||
ExcludeArchived bool `yaml:"excludearchived"`
|
||||
ExcludeForks bool `yaml:"excludeforks"`
|
||||
}
|
||||
|
||||
// GetToken TODO.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue