mirror of
https://github.com/Luzifer/repo-template.git
synced 2024-12-22 20:21:19 +00:00
Add filter for archived repos
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
46c353bbec
commit
84dcf96209
1 changed files with 3 additions and 0 deletions
|
@ -10,11 +10,14 @@ import (
|
||||||
type filterFunc func(*github.Repository) bool
|
type filterFunc func(*github.Repository) bool
|
||||||
|
|
||||||
var filters = map[string]filterFunc{
|
var filters = map[string]filterFunc{
|
||||||
|
"archived": filterArchived,
|
||||||
"fork": filterFork,
|
"fork": filterFork,
|
||||||
"dockerfile": filterDockerfile,
|
"dockerfile": filterDockerfile,
|
||||||
"public": filterPublic,
|
"public": filterPublic,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func filterArchived(repo *github.Repository) bool { return repo.Archived != nil && *repo.Archived }
|
||||||
|
|
||||||
func filterDockerfile(repo *github.Repository) bool {
|
func filterDockerfile(repo *github.Repository) bool {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
_, _, resp, err := client.Repositories.GetContents(ctx, *repo.Owner.Login, *repo.Name, "Dockerfile", nil)
|
_, _, resp, err := client.Repositories.GetContents(ctx, *repo.Owner.Login, *repo.Name, "Dockerfile", nil)
|
||||||
|
|
Loading…
Reference in a new issue