1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-11 17:50:58 +00:00

Implement UnmarshalYAML for ActionRunsUsing (#223)

In #222 I added case normalisation to ReadAction() to ensure that Docker and docker are interpreted the same way.

I realised that this was being done at the wrong level and required multiple type conversions. By implementing `func (a ActionRunsUsing) UnmarshalYAML` we can lowercase the string as it's being unserialized

This has an added benefit that any time this type is hydrated the `runs.using` key will be lowercased, rather than relying on `ReadAction()`
This commit is contained in:
Michael Heap 2020-05-04 13:40:11 +01:00 committed by GitHub
parent dea1ed5769
commit 18bc8ff929
2 changed files with 22 additions and 5 deletions

View file

@ -307,7 +307,7 @@ func (sc *StepContext) runAction(actionDir string, actionPath string) common.Exe
stepContainer.Remove().IfBool(!rc.Config.ReuseContainers),
)(ctx)
default:
return fmt.Errorf(fmt.Sprintf("The runs.using key in action.yml must be one of: %v, got %s", []string{
return fmt.Errorf(fmt.Sprintf("The runs.using key must be one of: %v, got %s", []string{
model.ActionRunsUsingDocker,
model.ActionRunsUsingNode12,
}, action.Runs.Using))