Files
act_runner/pkg/runner/step_factory.go
Steven Edwards 70c9e21c85 update go imports (#20)
* Replace nektos/act imports with actions-oss/act-cli

* Update go.mod to reference new repo

* Fix goimports "not properly formatted" complaints.

Replacing the imports left some out of alphabetical order.
2025-01-27 18:11:12 +01:00

47 lines
1.1 KiB
Go

package runner
import (
"fmt"
"github.com/actions-oss/act-cli/pkg/model"
)
type stepFactory interface {
newStep(step *model.Step, rc *RunContext) (step, error)
}
type stepFactoryImpl struct{}
func (sf *stepFactoryImpl) newStep(stepModel *model.Step, rc *RunContext) (step, error) {
switch stepModel.Type() {
case model.StepTypeInvalid:
return nil, fmt.Errorf("Invalid run/uses syntax for job:%s step:%+v", rc.Run, stepModel)
case model.StepTypeRun:
return &stepRun{
Step: stepModel,
RunContext: rc,
}, nil
case model.StepTypeUsesActionLocal:
return &stepActionLocal{
Step: stepModel,
RunContext: rc,
readAction: readActionImpl,
runAction: runActionImpl,
}, nil
case model.StepTypeUsesActionRemote:
return &stepActionRemote{
Step: stepModel,
RunContext: rc,
readAction: readActionImpl,
runAction: runActionImpl,
}, nil
case model.StepTypeUsesDockerURL:
return &stepDocker{
Step: stepModel,
RunContext: rc,
}, nil
}
return nil, fmt.Errorf("Unable to determine how to run job:%s step:%+v", rc.Run, stepModel)
}