diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index a7aa321811..4d2d813694 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -48,6 +48,8 @@ func NewFuncMap() template.FuncMap {
// utils
"StringUtils": NewStringUtils,
"SliceUtils": NewSliceUtils,
+ "slice": func() []any { return []any{} },
+ "Append": func(s []any, v any) []any { return append(s, v) },
"JsonUtils": NewJsonUtils,
"DateUtils": NewDateUtils,
diff --git a/modules/templates/util_slice.go b/modules/templates/util_slice.go
index a3318cc11a..33fa5fff8f 100644
--- a/modules/templates/util_slice.go
+++ b/modules/templates/util_slice.go
@@ -33,3 +33,17 @@ func (su *SliceUtils) Contains(s, v any) bool {
}
return false
}
+
+// Append appends an element to a slice and returns the new slice
+func (su *SliceUtils) Append(s any, v any) any {
+ if s == nil {
+ return []any{v}
+ }
+ sv := reflect.ValueOf(s)
+ if sv.Kind() != reflect.Slice {
+ panic(fmt.Sprintf("invalid type, expected slice, but got: %T", s))
+ }
+ // Create a new slice with the appended element
+ newSlice := reflect.Append(sv, reflect.ValueOf(v))
+ return newSlice.Interface()
+}
diff --git a/modules/templates/util_string.go b/modules/templates/util_string.go
index 683c77a870..bd2ddba278 100644
--- a/modules/templates/util_string.go
+++ b/modules/templates/util_string.go
@@ -61,6 +61,10 @@ func (su *StringUtils) ToUpper(s string) string {
return strings.ToUpper(s)
}
+func (su *StringUtils) ToLower(s string) string {
+ return strings.ToLower(s)
+}
+
func (su *StringUtils) TrimPrefix(s, prefix string) string {
return strings.TrimPrefix(s, prefix)
}
diff --git a/services/org/pinned.go b/services/org/pinned.go
index e82cfa17f1..ffce57bbae 100644
--- a/services/org/pinned.go
+++ b/services/org/pinned.go
@@ -37,9 +37,13 @@ func GetOrgPinnedReposWithDetails(ctx context.Context, orgID int64) ([]*organiza
return nil, err
}
- // Attach repos
+ // Attach repos and load attributes (including primary language)
for _, p := range pinnedRepos {
- p.Repo = repos[p.RepoID]
+ repo := repos[p.RepoID]
+ if repo != nil {
+ _ = repo.LoadAttributes(ctx)
+ }
+ p.Repo = repo
}
return pinnedRepos, nil
diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl
index 5b7f7bbf47..0131f11f5f 100644
--- a/templates/repo/release/list.tmpl
+++ b/templates/repo/release/list.tmpl
@@ -92,23 +92,137 @@