refactor: dont use topics

See coop-cloud/organising#377
See coop-cloud/organising#569
This commit is contained in:
decentral1se 2024-10-21 22:18:29 +02:00 committed by decentral1se
parent 17e15dba77
commit a379b31a19

View File

@ -8,7 +8,6 @@ import (
"net/url"
"os"
"path"
"slices"
"sort"
"strconv"
"strings"
@ -59,11 +58,6 @@ type RecipeMeta struct {
Website string `json:"website"`
}
// TopicMeta represents a list of topics for a repository.
type TopicMeta struct {
Topics []string `json:"topics"`
}
// LatestVersion returns the latest version of a recipe.
func (r RecipeMeta) LatestVersion() string {
var version string
@ -562,16 +556,7 @@ func ReadReposMetadata() (RepoCatalogue, error) {
}
for idx, repo := range reposList {
var topicMeta TopicMeta
topicsURL := getReposTopicUrl(repo.Name)
if err := web.ReadJSON(topicsURL, &topicMeta); err != nil {
return reposMeta, err
}
if slices.Contains(topicMeta.Topics, "recipe") && repo.Name != "example" {
reposMeta[repo.Name] = reposList[idx]
}
reposMeta[repo.Name] = reposList[idx]
}
pageIdx++
@ -679,11 +664,6 @@ func UpdateRepositories(repos RepoCatalogue, recipeName string) error {
return nil
}
// getReposTopicUrl retrieves the repository specific topic listing.
func getReposTopicUrl(repoName string) string {
return fmt.Sprintf("https://git.coopcloud.tech/api/v1/repos/coop-cloud/%s/topics", repoName)
}
// ensurePathExists ensures that a path exists.
func ensurePathExists(path string) error {
if _, err := os.Stat(path); err != nil && os.IsNotExist(err) {