From 16102d378731cedaf2014e225318a02274a9180c Mon Sep 17 00:00:00 2001 From: Giteabot Date: Tue, 18 Jul 2023 02:40:28 -0400 Subject: [PATCH] Ignore `runs-on` with expressions when warning no matched runners (#25917) (#25933) Backport #25917 by @wolfogre Fix #25905 Co-authored-by: Jason Song (cherry picked from commit b7d054e4b5ccabbc1bf10824b6e3483a53c437f9) --- routers/web/repo/actions/actions.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/routers/web/repo/actions/actions.go b/routers/web/repo/actions/actions.go index 87ff07d5eb..4bf235c436 100644 --- a/routers/web/repo/actions/actions.go +++ b/routers/web/repo/actions/actions.go @@ -6,6 +6,7 @@ package actions import ( "bytes" "net/http" + "strings" actions_model "code.gitea.io/gitea/models/actions" "code.gitea.io/gitea/models/db" @@ -105,6 +106,12 @@ func List(ctx *context.Context) { for _, j := range wf.Jobs { runsOnList := j.RunsOn() for _, ro := range runsOnList { + if strings.Contains(ro, "${{") { + // Skip if it contains expressions. + // The expressions could be very complex and could not be evaluated here, + // so just skip it, it's OK since it's just a tooltip message. + continue + } if !allRunnerLabels.Contains(ro) { workflow.ErrMsg = ctx.Locale.Tr("actions.runs.no_matching_runner_helper", ro) break