diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 41f6c5055d64b..d0238f5268afb 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -3690,6 +3690,15 @@ management = Secrets Management [actions] actions = Actions +general = General +general.approval_for_workflows_from_contributors = Approval for running fork pull request workflows from contributors +general.approval_for_workflows_from_contributors_desc = Choose which subset of users will require approval before running workflows on their pull requests. Both the pull request author and the actor of the pull request event triggering the workflow will be checked to determine if approval is required. If approval is required, a user with write access to the repository must approve the pull request workflow to be run. +general.approval_for_first_time_contributors_to_gitea = Require approval for first-time contributors who are new to Gitea +general.approval_for_first_time_contributors_to_gitea_helper = Only users who are both new on Gitea and who have never had a commit or pull request merged into this repository will require approval to run workflows. +general.approval_for_first_time_contributors = Require approval for first-time contributors +general.approval_for_first_time_contributors_helper = Only users who have never had a commit or pull request merged into this repository will require approval to run workflows. +general.approval_for_all_external_contributors = Require approval for all external contributors +general.approval_for_all_external_contributors_helper = All users that are not a member or owner of this repository and not a member of the %s will require approval to run workflows. unit.desc = Manage actions diff --git a/routers/web/repo/setting/action.go b/routers/web/repo/setting/action.go new file mode 100644 index 0000000000000..d07759b8bc86a --- /dev/null +++ b/routers/web/repo/setting/action.go @@ -0,0 +1,37 @@ +// Copyright 2025 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package setting + +import ( + "net/http" + + "code.gitea.io/gitea/modules/templates" + "code.gitea.io/gitea/services/context" +) + +const ( + tmplRepoActionsGeneral templates.TplName = "repo/settings/actions" +) + +// General ... +func General(ctx *context.Context) { + ctx.Data["PageIsSharedSettingsActionsGeneral"] = true + ctx.Data["Title"] = ctx.Tr("actions.general") + ctx.Data["PageType"] = "general" + + ctx.Data["Checked"] = 3 + + ctx.HTML(http.StatusOK, tmplRepoActionsGeneral) +} + +// GeneralPost ... +func GeneralPost(ctx *context.Context) { + ctx.Data["PageIsSharedSettingsActionsGeneral"] = true + ctx.Data["Title"] = ctx.Tr("actions.general") + ctx.Data["PageType"] = "general" + + ctx.Data["Checked"] = 3 + + ctx.HTML(http.StatusOK, tmplRepoActionsGeneral) +} diff --git a/routers/web/repo/setting/runners.go b/routers/web/repo/setting/runners.go index 94f2ae7a0c092..8d58b5023efb3 100644 --- a/routers/web/repo/setting/runners.go +++ b/routers/web/repo/setting/runners.go @@ -181,7 +181,3 @@ func RunnerDeletePost(ctx *context.Context) { } actions_shared.RunnerDeletePost(ctx, ctx.PathParamInt64("runnerid"), rCtx.RedirectLink, rCtx.RedirectLink+url.PathEscape(ctx.PathParam("runnerid"))) } - -func RedirectToDefaultSetting(ctx *context.Context) { - ctx.Redirect(ctx.Repo.RepoLink + "/settings/actions/runners") -} diff --git a/routers/web/web.go b/routers/web/web.go index 609a7d77ac596..4c66b37cd0ea0 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -1135,7 +1135,8 @@ func registerRoutes(m *web.Router) { }) }) m.Group("/actions", func() { - m.Get("", repo_setting.RedirectToDefaultSetting) + m.Get("", repo_setting.General) + m.Post("", repo_setting.GeneralPost) addSettingsRunnersRoutes() addSettingsSecretsRoutes() addSettingsVariablesRoutes() diff --git a/templates/repo/settings/actions.tmpl b/templates/repo/settings/actions.tmpl index f38ab5b658412..5f42e2f32705f 100644 --- a/templates/repo/settings/actions.tmpl +++ b/templates/repo/settings/actions.tmpl @@ -1,6 +1,8 @@ {{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings actions")}}