@@ -24,6 +24,7 @@ import (
24
24
repo_model "code.gitea.io/gitea/models/repo"
25
25
unit_model "code.gitea.io/gitea/models/unit"
26
26
user_model "code.gitea.io/gitea/models/user"
27
+ "code.gitea.io/gitea/modules/actions"
27
28
"code.gitea.io/gitea/modules/base"
28
29
"code.gitea.io/gitea/modules/charset"
29
30
"code.gitea.io/gitea/modules/container"
@@ -39,6 +40,8 @@ import (
39
40
"code.gitea.io/gitea/modules/typesniffer"
40
41
"code.gitea.io/gitea/modules/util"
41
42
"code.gitea.io/gitea/routers/web/feed"
43
+
44
+ "github.com/nektos/act/pkg/model"
42
45
)
43
46
44
47
const (
@@ -348,6 +351,15 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
348
351
if issueConfigErr != nil {
349
352
ctx .Data ["FileError" ] = strings .TrimSpace (issueConfigErr .Error ())
350
353
}
354
+ } else if actions .IsWorkflow (ctx .Repo .TreePath ) {
355
+ content , err := actions .GetContentFromEntry (entry )
356
+ if err != nil {
357
+ log .Error ("actions.GetContentFromEntry: %v" , err )
358
+ }
359
+ _ , workFlowErr := model .ReadWorkflow (bytes .NewReader (content ))
360
+ if workFlowErr != nil {
361
+ ctx .Data ["FileError" ] = ctx .Locale .Tr ("actions.runs.invalid_workflow_helper" , workFlowErr .Error ())
362
+ }
351
363
}
352
364
353
365
isDisplayingSource := ctx .FormString ("display" ) == "source"
0 commit comments