mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-03-24 07:45:02 +01:00
feat: allow configuring gitea schema mode (#23)
* config entries for schema change * remove broken/unused syntetic nodejs action * specify desired schema in model struct that is read by unmarshal * replace params by config * allows gitea context + env names * act --gitea now parses a subset of gitea specific workflows Reviewed-on: https://gitea.com/actions-oss/act-cli/pulls/23 Co-authored-by: Christopher Homberger <christopher.homberger@web.de> Co-committed-by: Christopher Homberger <christopher.homberger@web.de>
This commit is contained in:
committed by
ChristopherHX
parent
faa252c8e9
commit
933c4a5bd5
@@ -34,6 +34,7 @@ type ReadOnlyArray[T any] interface {
|
||||
|
||||
type ReadOnlyObject[T any] interface {
|
||||
Get(key string) T
|
||||
GetKv(key string) (string, T) // Returns the actual key used (for case-insensitive objects)
|
||||
GetEnumerator() map[string]T
|
||||
}
|
||||
|
||||
@@ -54,13 +55,18 @@ func (a BasicArray[T]) GetEnumerator() []T {
|
||||
type CaseInsensitiveObject[T any] map[string]T
|
||||
|
||||
func (o CaseInsensitiveObject[T]) Get(key string) T {
|
||||
_, v := o.GetKv(key)
|
||||
return v
|
||||
}
|
||||
|
||||
func (o CaseInsensitiveObject[T]) GetKv(key string) (k string, v T) {
|
||||
for k, v := range o {
|
||||
if strings.EqualFold(k, key) {
|
||||
return v
|
||||
return k, v
|
||||
}
|
||||
}
|
||||
var zero T
|
||||
return zero
|
||||
return key, zero
|
||||
}
|
||||
|
||||
func (o CaseInsensitiveObject[T]) GetEnumerator() map[string]T {
|
||||
@@ -73,6 +79,10 @@ func (o CaseSensitiveObject[T]) Get(key string) T {
|
||||
return o[key]
|
||||
}
|
||||
|
||||
func (o CaseSensitiveObject[T]) GetKv(key string) (string, T) {
|
||||
return key, o[key]
|
||||
}
|
||||
|
||||
func (o CaseSensitiveObject[T]) GetEnumerator() map[string]T {
|
||||
return o
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user