Skip to content

Commit

Permalink
Fix noisy runs-on error logging (#2102)
Browse files Browse the repository at this point in the history
Move the logging back up a level to fix a minor logging issue introduced in #2088

`RunContext`s for composite actions have dummy/blank `Job`s with no `runs-on`,
meaning their calls to `withGithubEnv` would result in an inaccurate log message
complaining that `'runs-on' key not defined in ...`

Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 16, 2023
1 parent 1b10028 commit 00fbfa7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/runner/run_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,10 @@ func (rc *RunContext) containerImage(ctx context.Context) string {
}

func (rc *RunContext) runsOnImage(ctx context.Context) string {
if rc.Run.Job().RunsOn() == nil {
common.Logger(ctx).Errorf("'runs-on' key not defined in %s", rc.String())
}

for _, platformName := range rc.runsOnPlatformNames(ctx) {
image := rc.Config.Platforms[strings.ToLower(platformName)]
if image != "" {
Expand All @@ -649,7 +653,6 @@ func (rc *RunContext) runsOnPlatformNames(ctx context.Context) []string {
job := rc.Run.Job()

if job.RunsOn() == nil {
common.Logger(ctx).Errorf("'runs-on' key not defined in %s", rc.String())
return []string{}
}

Expand Down

0 comments on commit 00fbfa7

Please sign in to comment.