1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-24 08:57:03 -05:00

Ignore runs-on with expressions when warning no matched runners (#25917) (#25933)

Backport #25917 by @wolfogre

Fix #25905

Co-authored-by: Jason Song <i@wolfogre.com>
(cherry picked from commit b7d054e4b5)
This commit is contained in:
Giteabot 2023-07-18 02:40:28 -04:00 committed by Earl Warren
parent d5c4f3430e
commit 16102d3787
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -6,6 +6,7 @@ package actions
import ( import (
"bytes" "bytes"
"net/http" "net/http"
"strings"
actions_model "code.gitea.io/gitea/models/actions" actions_model "code.gitea.io/gitea/models/actions"
"code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/db"
@ -105,6 +106,12 @@ func List(ctx *context.Context) {
for _, j := range wf.Jobs { for _, j := range wf.Jobs {
runsOnList := j.RunsOn() runsOnList := j.RunsOn()
for _, ro := range runsOnList { 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) { if !allRunnerLabels.Contains(ro) {
workflow.ErrMsg = ctx.Locale.Tr("actions.runs.no_matching_runner_helper", ro) workflow.ErrMsg = ctx.Locale.Tr("actions.runs.no_matching_runner_helper", ro)
break break