Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ github:
# (default: https://api.github.com)
url: https://github.mydomain.com
# (optional) Exclude this list of repos
excluded:
# or whole organizations/users
exclude:
- my-excluded-org
- my-excluded-user
- my-namespace/excluded-repository-name
# The gitlab section contains backup jobs for
# GitLab.com and GitLab on premise
Expand Down Expand Up @@ -68,7 +71,10 @@ gitlab:
# (default: https://gitlab.com/)
url: https://gitlab.mydomain.com
# (optional) Exclude this list of repos
excluded:
# or whole organizations/users
exclude:
- my-excluded-org
- my-excluded-user
- my-namespace/excluded-repository-name
```

Expand Down
13 changes: 12 additions & 1 deletion github.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,18 @@ func (c *GithubConfig) ListRepositories() ([]*Repository, error) {
gitUrl.User = url.UserPassword("github", c.AccessToken)

isExcluded := slices.ContainsFunc(c.Exclude, func(s string) bool {
return strings.EqualFold(s, *repo.FullName)
if strings.EqualFold(s, *repo.FullName) {
return true
}

if strings.Contains(s, "/") {
return false
}

repoFullName := *repo.FullName

repoOwner := repoFullName[:strings.Index(repoFullName, "/")]
return strings.EqualFold(s, repoOwner)
})
if isExcluded {
log.Printf("Skipping excluded repository: %s", *repo.FullName)
Expand Down
13 changes: 12 additions & 1 deletion gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,18 @@ func (g *GitLabConfig) ListRepositories() ([]*Repository, error) {
outSlice := make([]*Repository, 0, len(out))
for _, repository := range out {
isExcluded := slices.ContainsFunc(g.Exclude, func(s string) bool {
return strings.EqualFold(s, repository.FullName)
if strings.EqualFold(s, repository.FullName) {
return true
}

if strings.Contains(s, "/") {
return false
}

repoFullName := repository.FullName

repoOwner := repoFullName[:strings.Index(repoFullName, "/")]
return strings.EqualFold(s, repoOwner)
})
if isExcluded {
log.Printf("Skipping excluded repository: %s", repository.FullName)
Expand Down
Loading