refactor: dont use topics
See coop-cloud/organising#377 See coop-cloud/organising#569
This commit is contained in:
parent
17e15dba77
commit
a379b31a19
@ -8,7 +8,6 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"slices"
|
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -59,11 +58,6 @@ type RecipeMeta struct {
|
|||||||
Website string `json:"website"`
|
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.
|
// LatestVersion returns the latest version of a recipe.
|
||||||
func (r RecipeMeta) LatestVersion() string {
|
func (r RecipeMeta) LatestVersion() string {
|
||||||
var version string
|
var version string
|
||||||
@ -562,16 +556,7 @@ func ReadReposMetadata() (RepoCatalogue, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for idx, repo := range reposList {
|
for idx, repo := range reposList {
|
||||||
var topicMeta TopicMeta
|
reposMeta[repo.Name] = reposList[idx]
|
||||||
|
|
||||||
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]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pageIdx++
|
pageIdx++
|
||||||
@ -679,11 +664,6 @@ func UpdateRepositories(repos RepoCatalogue, recipeName string) error {
|
|||||||
return nil
|
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.
|
// ensurePathExists ensures that a path exists.
|
||||||
func ensurePathExists(path string) error {
|
func ensurePathExists(path string) error {
|
||||||
if _, err := os.Stat(path); err != nil && os.IsNotExist(err) {
|
if _, err := os.Stat(path); err != nil && os.IsNotExist(err) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user