From 195a6c9ffb01c550b657068ff5ee0f0e06ceddd0 Mon Sep 17 00:00:00 2001 From: Michael Heap Date: Mon, 4 May 2020 04:55:20 +0100 Subject: [PATCH] Add default error case for Runs.Using (#221) The string comparison in `step_context.go` is currently case sensitive. This commit adds an error that returns the valid options and tells the user what value they passed --- pkg/runner/step_context.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/runner/step_context.go b/pkg/runner/step_context.go index 70039b5..0af6411 100644 --- a/pkg/runner/step_context.go +++ b/pkg/runner/step_context.go @@ -306,8 +306,12 @@ func (sc *StepContext) runAction(actionDir string, actionPath string) common.Exe ).Finally( 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{ + model.ActionRunsUsingDocker, + model.ActionRunsUsingNode12, + }, action.Runs.Using)) } - return nil } }