fix: replace step.use -> step.uses to match gha spec

This commit is contained in:
Marc 2024-09-02 20:10:25 -04:00
parent 40ac4adc63
commit e25735ae01
Signed by: marc
GPG key ID: 048E042F22B5DC79
2 changed files with 6 additions and 6 deletions

View file

@ -48,7 +48,7 @@ func (r *Runner) RunWorkflow(workflow workflows.Workflow) TaskTracker {
workflow.Walk(func(n interface{}) { workflow.Walk(func(n interface{}) {
switch n.(type) { switch n.(type) {
case workflows.Step: case workflows.Step:
if useAction := n.(workflows.Step).Use; useAction != "" { if useAction := n.(workflows.Step).Uses; useAction != "" {
actions.NewActionsManager(r.Cache.Root).PrefetchAction(useAction) actions.NewActionsManager(r.Cache.Root).PrefetchAction(useAction)
} }
} }
@ -164,7 +164,7 @@ func (r *Runner) RunJobInContainer(imageUri string, containerId string, jobConte
Shell: stepShell, Shell: stepShell,
} }
stepError = r.RunCommandInContainer(containerId, step.Run, commandOptions) stepError = r.RunCommandInContainer(containerId, step.Run, commandOptions)
} else if step.Use != "" { } else if step.Uses != "" {
for key, value := range step.With { for key, value := range step.With {
stepEnv[actions.FormatInputEnvKey(key)] = value stepEnv[actions.FormatInputEnvKey(key)] = value
} }
@ -174,7 +174,7 @@ func (r *Runner) RunJobInContainer(imageUri string, containerId string, jobConte
Env: stepEnv, Env: stepEnv,
Shell: stepShell, Shell: stepShell,
} }
stepError = actions.NewActionsManager(r.Cache.Root).UseAction(step.Use, containerId, commandOptions) stepError = actions.NewActionsManager(r.Cache.Root).UseAction(step.Uses, containerId, commandOptions)
} }
if stepError != nil && !step.ContinueOnError { if stepError != nil && !step.ContinueOnError {

View file

@ -53,7 +53,7 @@ type Step struct {
ContinueOnError bool `yaml:"continue-on-error"` ContinueOnError bool `yaml:"continue-on-error"`
Env map[string]string `yaml:"env"` Env map[string]string `yaml:"env"`
Shell string `yaml:"shell"` Shell string `yaml:"shell"`
Use string `yaml:"use"` Uses string `yaml:"uses"`
With map[string]string `yaml:"with"` With map[string]string `yaml:"with"`
} }
@ -64,8 +64,8 @@ func (s Step) Walk(handler func(node interface{})) {
func (s Step) Validate() []error { func (s Step) Validate() []error {
validationErrors := []error{} validationErrors := []error{}
if s.Run == "" && s.Use == "" { if s.Run == "" && s.Uses == "" {
validationErrors = append(validationErrors, errors.New("Must have a \"run\" or \"step\" clause.")) validationErrors = append(validationErrors, errors.New("Must have a \"run\" or \"uses\" clause."))
} }
return validationErrors return validationErrors