mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-03-20 03:46:09 +08:00
* 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>
45 lines
1.2 KiB
Go
45 lines
1.2 KiB
Go
package schema
|
|
|
|
import "slices"
|
|
|
|
func GetGiteaWorkflowSchema() *Schema {
|
|
schema := GetWorkflowSchema()
|
|
in := schema.Definitions
|
|
schema.Definitions = map[string]Definition{}
|
|
for k, v := range in {
|
|
if v.Context != nil && slices.Contains(v.Context, "github") {
|
|
v.Context = append(v.Context, "gitea", "env")
|
|
}
|
|
if k == "step-if" || k == "job-if" || k == "string-strategy-context" {
|
|
v.Context = append(v.Context, "secrets")
|
|
}
|
|
schema.Definitions[k] = v
|
|
}
|
|
updateUses(schema.Definitions["workflow-job"].Mapping)
|
|
updateUses(schema.Definitions["regular-step"].Mapping)
|
|
|
|
schema.Definitions["container-mapping"].Mapping.Properties["cmd"] = MappingProperty{
|
|
Type: "sequence-of-non-empty-string",
|
|
}
|
|
return schema
|
|
}
|
|
|
|
func updateUses(mapping *MappingDefinition) {
|
|
uses := mapping.Properties["uses"]
|
|
uses.Type = "string-strategy-context"
|
|
mapping.Properties["uses"] = uses
|
|
}
|
|
|
|
func GetGiteaActionSchema() *Schema {
|
|
schema := GetActionSchema()
|
|
in := schema.Definitions
|
|
schema.Definitions = map[string]Definition{}
|
|
for k, v := range in {
|
|
if v.Context != nil && slices.Contains(v.Context, "github") {
|
|
v.Context = append(v.Context, "gitea", "env")
|
|
}
|
|
schema.Definitions[k] = v
|
|
}
|
|
return schema
|
|
}
|