1
0
Fork 0
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:
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
var filters = map[string]filterFunc{
"archived": filterArchived,
"fork": filterFork,
"dockerfile": filterDockerfile,
"public": filterPublic,
}
func filterArchived(repo *github.Repository) bool { return repo.Archived != nil && *repo.Archived }
func filterDockerfile(repo *github.Repository) bool {
ctx := context.Background()
_, _, resp, err := client.Repositories.GetContents(ctx, *repo.Owner.Login, *repo.Name, "Dockerfile", nil)