mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-03-24 15:55:03 +01:00
Replace expressions engine (#133)
This commit is contained in:
31
pkg/schema/gitea_schema.go
Normal file
31
pkg/schema/gitea_schema.go
Normal file
@@ -0,0 +1,31 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user