From e25735ae0175eadb338cfad4ab2d3fe55cdc32ae Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Mon, 2 Sep 2024 20:10:25 -0400 Subject: [PATCH] fix: replace step.use -> step.uses to match gha spec --- internal/runner/runner.go | 6 +++--- internal/workflow/models.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/runner/runner.go b/internal/runner/runner.go index 158c2ce..0216ee1 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -48,7 +48,7 @@ func (r *Runner) RunWorkflow(workflow workflows.Workflow) TaskTracker { workflow.Walk(func(n interface{}) { switch n.(type) { case workflows.Step: - if useAction := n.(workflows.Step).Use; useAction != "" { + if useAction := n.(workflows.Step).Uses; useAction != "" { actions.NewActionsManager(r.Cache.Root).PrefetchAction(useAction) } } @@ -164,7 +164,7 @@ func (r *Runner) RunJobInContainer(imageUri string, containerId string, jobConte Shell: stepShell, } stepError = r.RunCommandInContainer(containerId, step.Run, commandOptions) - } else if step.Use != "" { + } else if step.Uses != "" { for key, value := range step.With { stepEnv[actions.FormatInputEnvKey(key)] = value } @@ -174,7 +174,7 @@ func (r *Runner) RunJobInContainer(imageUri string, containerId string, jobConte Env: stepEnv, 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 { diff --git a/internal/workflow/models.go b/internal/workflow/models.go index 988d845..023713f 100644 --- a/internal/workflow/models.go +++ b/internal/workflow/models.go @@ -53,7 +53,7 @@ type Step struct { ContinueOnError bool `yaml:"continue-on-error"` Env map[string]string `yaml:"env"` Shell string `yaml:"shell"` - Use string `yaml:"use"` + Uses string `yaml:"uses"` With map[string]string `yaml:"with"` } @@ -64,8 +64,8 @@ func (s Step) Walk(handler func(node interface{})) { func (s Step) Validate() []error { validationErrors := []error{} - if s.Run == "" && s.Use == "" { - validationErrors = append(validationErrors, errors.New("Must have a \"run\" or \"step\" clause.")) + if s.Run == "" && s.Uses == "" { + validationErrors = append(validationErrors, errors.New("Must have a \"run\" or \"uses\" clause.")) } return validationErrors