diff --git a/routers/web/repo/actions/actions.go b/routers/web/repo/actions/actions.go index 4511629948..a8e791a584 100644 --- a/routers/web/repo/actions/actions.go +++ b/routers/web/repo/actions/actions.go @@ -208,6 +208,10 @@ func List(ctx *context.Context) { actionsConfig := ctx.Repo.Repository.MustGetUnit(ctx, unit.TypeActions).ActionsConfig() ctx.Data["ActionsConfig"] = actionsConfig + if strings.HasSuffix(ctx.Repo.Repository.Name, ".workflow") { + ctx.Data["AllowGlobalWorkflow"] = true + } + if len(workflowID) > 0 && ctx.Repo.IsAdmin() { ctx.Data["AllowDisableOrEnableWorkflow"] = true isWorkflowDisabled := actionsConfig.IsWorkflowDisabled(workflowID) diff --git a/templates/repo/actions/list.tmpl b/templates/repo/actions/list.tmpl index 3ad80fc037..0a582291b1 100644 --- a/templates/repo/actions/list.tmpl +++ b/templates/repo/actions/list.tmpl @@ -81,10 +81,11 @@ {{if .CurWorkflowDisabled}}{{ctx.Locale.Tr "actions.workflow.enable"}}{{else}}{{ctx.Locale.Tr "actions.workflow.disable"}}{{end}} - - {{if .CurGlobalWorkflowEnable}}{{ctx.Locale.Tr "actions.workflow.global_disable"}}{{else}}{{ctx.Locale.Tr "actions.workflow.global_enable"}}{{end}} - - + {{if .AllowGlobalWorkflow}} + + {{if .CurGlobalWorkflowEnable}}{{ctx.Locale.Tr "actions.workflow.global_disable"}}{{else}}{{ctx.Locale.Tr "actions.workflow.global_enable"}}{{end}} + + {{end}} {{end}}