From e37b42a333c53503e6688c8e844e7c037f85179a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cat=E2=84=A2?= Date: Thu, 21 Jan 2021 14:02:48 +0000 Subject: [PATCH] Print error with workflow/job information when runs-on key is not defined (#494) Co-authored-by: Casey Lee --- pkg/runner/run_context.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/runner/run_context.go b/pkg/runner/run_context.go index 43ec4d5..d9b632d 100644 --- a/pkg/runner/run_context.go +++ b/pkg/runner/run_context.go @@ -239,6 +239,10 @@ func (rc *RunContext) platformImage() string { return rc.ExprEval.Interpolate(c.Image) } + if job.RunsOn() == nil { + log.Errorf("'runs-on' key not defined in %s", rc.String()) + } + for _, runnerLabel := range job.RunsOn() { platformName := rc.ExprEval.Interpolate(runnerLabel) image := rc.Config.Platforms[strings.ToLower(platformName)] @@ -265,6 +269,10 @@ func (rc *RunContext) isEnabled(ctx context.Context) bool { img := rc.platformImage() if img == "" { + if job.RunsOn() == nil { + log.Errorf("'runs-on' key not defined in %s", rc.String()) + } + for _, runnerLabel := range job.RunsOn() { platformName := rc.ExprEval.Interpolate(runnerLabel) l.Infof("\U0001F6A7 Skipping unsupported platform '%+v'", platformName)