@@ -5,6 +5,7 @@ package actions
55
66import (
77 "bytes"
8+ "fmt"
89 "net/http"
910
1011 actions_model "code.gitea.io/gitea/models/actions"
@@ -16,6 +17,7 @@ import (
1617 "code.gitea.io/gitea/modules/context"
1718 "code.gitea.io/gitea/modules/git"
1819 "code.gitea.io/gitea/modules/setting"
20+ "code.gitea.io/gitea/routers/web/repo"
1921 "code.gitea.io/gitea/services/convert"
2022
2123 "github.com/nektos/act/pkg/model"
@@ -125,7 +127,16 @@ func List(ctx *context.Context) {
125127 }
126128
127129 workflow := ctx .FormString ("workflow" )
130+ actorID := ctx .FormInt64 ("actor" )
131+ status := ctx .FormInt ("status" )
128132 ctx .Data ["CurWorkflow" ] = workflow
133+ // if status or actor query param is not given to frontend href, (href="/<repoLink>/actions")
134+ // they will be 0 by default, which indicates get all status or actors
135+ ctx .Data ["CurActor" ] = actorID
136+ ctx .Data ["CurStatus" ] = status
137+ if actorID > 0 || status > int (actions_model .StatusUnknown ) {
138+ ctx .Data ["IsFiltered" ] = true
139+ }
129140
130141 opts := actions_model.FindRunOptions {
131142 ListOptions : db.ListOptions {
@@ -134,6 +145,8 @@ func List(ctx *context.Context) {
134145 },
135146 RepoID : ctx .Repo .Repository .ID ,
136147 WorkflowFileName : workflow ,
148+ TriggerUserID : actorID ,
149+ Status : actions_model .Status (status ),
137150 }
138151
139152 runs , total , err := actions_model .FindRuns (ctx , opts )
@@ -153,9 +166,20 @@ func List(ctx *context.Context) {
153166
154167 ctx .Data ["Runs" ] = runs
155168
169+ actors , err := actions_model .GetActors (ctx , ctx .Repo .Repository .ID )
170+ if err != nil {
171+ ctx .Error (http .StatusInternalServerError , err .Error ())
172+ return
173+ }
174+ ctx .Data ["Actors" ] = repo .MakeSelfOnTop (ctx , actors )
175+
176+ ctx .Data ["StatusInfoList" ] = actions_model .GetStatusInfoList (ctx )
177+
156178 pager := context .NewPagination (int (total ), opts .PageSize , opts .Page , 5 )
157179 pager .SetDefaultParams (ctx )
158180 pager .AddParamString ("workflow" , workflow )
181+ pager .AddParamString ("actor" , fmt .Sprint (actorID ))
182+ pager .AddParamString ("status" , fmt .Sprint (status ))
159183 ctx .Data ["Page" ] = pager
160184
161185 ctx .HTML (http .StatusOK , tplListActions )
0 commit comments