mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-06 16:32:31 +01:00
24 lines
648 B
Go
24 lines
648 B
Go
package workflow
|
|
|
|
import (
|
|
. "github.com/mickael-kerjean/filestash/server/common"
|
|
_ "github.com/mickael-kerjean/filestash/server/workflow/actions"
|
|
. "github.com/mickael-kerjean/filestash/server/workflow/model"
|
|
)
|
|
|
|
func ExecuteAction(action Step, input map[string]string) (map[string]string, error) {
|
|
currAction, err := findAction(action.Name)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return currAction.Execute(action.Params, input)
|
|
}
|
|
|
|
func findAction(action string) (IAction, error) {
|
|
for _, currAction := range Hooks.Get.WorkflowActions() {
|
|
if currAction.Manifest().Name == action {
|
|
return currAction, nil
|
|
}
|
|
}
|
|
return nil, ErrNotFound
|
|
}
|