1
0
Fork 0
mirror of https://github.com/Luzifer/repo-template.git synced 2024-12-23 04:31:20 +00:00

Add filter for archived repos

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-02-07 15:26:47 +01:00
parent 46c353bbec
commit 84dcf96209
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -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)