Print error with workflow/job information when runs-on key is not defined (#494)

Co-authored-by: Casey Lee <cplee@nektos.com>
This commit is contained in:
Cat™ 2021-01-21 14:02:48 +00:00 committed by GitHub
parent 719a077b7c
commit e37b42a333
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -239,6 +239,10 @@ func (rc *RunContext) platformImage() string {
return rc.ExprEval.Interpolate(c.Image) 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() { for _, runnerLabel := range job.RunsOn() {
platformName := rc.ExprEval.Interpolate(runnerLabel) platformName := rc.ExprEval.Interpolate(runnerLabel)
image := rc.Config.Platforms[strings.ToLower(platformName)] image := rc.Config.Platforms[strings.ToLower(platformName)]
@ -265,6 +269,10 @@ func (rc *RunContext) isEnabled(ctx context.Context) bool {
img := rc.platformImage() img := rc.platformImage()
if img == "" { if img == "" {
if job.RunsOn() == nil {
log.Errorf("'runs-on' key not defined in %s", rc.String())
}
for _, runnerLabel := range job.RunsOn() { for _, runnerLabel := range job.RunsOn() {
platformName := rc.ExprEval.Interpolate(runnerLabel) platformName := rc.ExprEval.Interpolate(runnerLabel)
l.Infof("\U0001F6A7 Skipping unsupported platform '%+v'", platformName) l.Infof("\U0001F6A7 Skipping unsupported platform '%+v'", platformName)