package main import ( "fmt" "bufio" "os" "code.gitea.io/sdk/gitea" ) var bad_names = []string{"cash_support","tech_advice","techjaadu","cash_app","academic_help","cashapp","cashhelpsapp","robinhood","contactsupport","squarecash","tech_advise","technical_support","technician-help","tech_support","technicalservices","technicalsupport","onlineserviceprovider","cash-operation"} func main() { client, _ := gitea.NewClient("_REPO_", gitea.SetToken("_TOKEN_")) repos_to_ban := []*gitea.Repository{} for _, banned_name := range bad_names { repos, _, _ := client.SearchRepos( gitea.SearchRepoOptions{ Keyword: banned_name, ListOptions: gitea.ListOptions{ PageSize: 100, }, }) for _, x := range repos { fmt.Printf("%+v - %+v\n", x.Owner.UserName, x.FullName) repos_to_ban = append(repos_to_ban, x) } } fmt.Print("These okay to delete? [y/n] ") input := bufio.NewScanner(os.Stdin) input.Scan() fmt.Println(input.Text()) for _, x := range repos_to_ban { client.DeleteRepo(x.Owner.UserName, x.Name) } for _, x := range repos_to_ban { client.AdminDeleteUser(x.Owner.UserName) } }