Skip to content

Commit c6b6ac4

Browse files
Allow users with write permission to run actions
1 parent 703be6b commit c6b6ac4

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
@@ -1405,7 +1405,7 @@ func registerRoutes(m *web.Router) {
14051405
m.Get("", actions.List)
14061406
m.Post("/disable", reqRepoAdmin, actions.DisableWorkflowFile)
14071407
m.Post("/enable", reqRepoAdmin, actions.EnableWorkflowFile)
1408-
m.Post("/run", reqRepoAdmin, actions.Run)
1408+
m.Post("/run", reqRepoActionsWriter, actions.Run)
14091409

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

0 commit comments

Comments
 (0)