Skip to content

Commit 1b296ed

Browse files
Allow users with write permission to run actions (#32644)
--- I have a use case where I need a team to be able to run actions without admin access.
1 parent 16a7d34 commit 1b296ed

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Diff for: routers/web/repo/actions/actions.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ func List(ctx *context.Context) {
168168
actionsConfig := ctx.Repo.Repository.MustGetUnit(ctx, unit.TypeActions).ActionsConfig()
169169
ctx.Data["ActionsConfig"] = actionsConfig
170170

171-
if len(workflowID) > 0 && ctx.Repo.IsAdmin() {
172-
ctx.Data["AllowDisableOrEnableWorkflow"] = true
171+
if len(workflowID) > 0 && ctx.Repo.CanWrite(unit.TypeActions) {
172+
ctx.Data["AllowDisableOrEnableWorkflow"] = ctx.Repo.IsAdmin()
173173
isWorkflowDisabled := actionsConfig.IsWorkflowDisabled(workflowID)
174174
ctx.Data["CurWorkflowDisabled"] = isWorkflowDisabled
175175

Diff for: routers/web/web.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1406,7 +1406,7 @@ func registerRoutes(m *web.Router) {
14061406
m.Get("", actions.List)
14071407
m.Post("/disable", reqRepoAdmin, actions.DisableWorkflowFile)
14081408
m.Post("/enable", reqRepoAdmin, actions.EnableWorkflowFile)
1409-
m.Post("/run", reqRepoAdmin, actions.Run)
1409+
m.Post("/run", reqRepoActionsWriter, actions.Run)
14101410

14111411
m.Group("/runs/{run}", func() {
14121412
m.Combo("").

0 commit comments

Comments
 (0)