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:
Christopher Homberger
2026-02-14 16:23:59 +00:00
committed by ChristopherHX
parent faa252c8e9
commit 933c4a5bd5
25 changed files with 265 additions and 253 deletions

View File

@@ -83,13 +83,29 @@ type Action struct {
Color string `yaml:"color"`
Icon string `yaml:"icon"`
} `yaml:"branding"`
Definition string `yaml:"-"`
Schema *schema.Schema `yaml:"-"`
}
func (a *Action) GetDefinition() string {
if a.Definition == "" {
return "action-root"
}
return a.Definition
}
func (a *Action) GetSchema() *schema.Schema {
if a.Schema == nil {
return schema.GetActionSchema()
}
return a.Schema
}
func (a *Action) UnmarshalYAML(node *yaml.Node) error {
// Validate the schema before deserializing it into our model
if err := (&schema.Node{
Definition: "action-root",
Schema: schema.GetActionSchema(),
Definition: a.GetDefinition(),
Schema: a.GetSchema(),
}).UnmarshalYAML(node); err != nil {
return err
}
@@ -110,9 +126,16 @@ type Output struct {
Value string `yaml:"value"`
}
type ActionConfig struct {
Definition string
Schema *schema.Schema
}
// ReadAction reads an action from a reader
func ReadAction(in io.Reader) (*Action, error) {
func ReadAction(in io.Reader, config ActionConfig) (*Action, error) {
a := new(Action)
a.Schema = config.Schema
a.Definition = config.Definition
err := yaml.NewDecoder(in).Decode(a)
if err != nil {
return nil, err