File tree Expand file tree Collapse file tree 8 files changed +63
-4
lines changed Expand file tree Collapse file tree 8 files changed +63
-4
lines changed Original file line number Diff line number Diff line change @@ -169,7 +169,8 @@ func (cfg *PullRequestsConfig) GetDefaultMergeStyle() MergeStyle {
169169}
170170
171171type ActionsConfig struct {
172- DisabledWorkflows []string
172+ DisabledWorkflows []string
173+ AccessbleFromOtherRepos bool
173174}
174175
175176func (cfg * ActionsConfig ) EnableWorkflow (file string ) {
Original file line number Diff line number Diff line change @@ -3751,6 +3751,11 @@ variables.creation.success = The variable "%s" has been added.
37513751variables.update.failed = Failed to edit variable.
37523752variables.update.success = The variable has been edited.
37533753
3754+ general = General
3755+ general.settings = Actions General Settings
3756+ general.actions_accessible_from_other_repositories = Accessible from repositories owned by ' %s'
3757+ general.actions_accessible_from_other_repositories_desc = Workflows in other repositories that are owned by the user ' %s' can access the actions and reusable workflows in this repository. Access is allowed only from private repositories.
3758+
37543759[projects]
37553760deleted.display_name = Deleted Project
37563761type-1.display_name = Individual Project
Original file line number Diff line number Diff line change @@ -195,8 +195,16 @@ func httpBase(ctx *context.Context) *serviceHandler {
195195 return nil
196196 }
197197 if task .RepoID != repo .ID {
198- ctx .PlainText (http .StatusForbidden , "User permission denied" )
199- return nil
198+ taskRepo , err := repo_model .GetRepositoryByID (ctx , task .RepoID )
199+ if err != nil {
200+ ctx .ServerError ("GetRepositoryByID" , err )
201+ return nil
202+ }
203+ actionsCfg := repo .MustGetUnit (ctx , unit .TypeActions ).ActionsConfig ()
204+ if ! taskRepo .IsPrivate || taskRepo .OwnerID != repo .OwnerID || ! actionsCfg .AccessbleFromOtherRepos {
205+ ctx .PlainText (http .StatusForbidden , "User permission denied" )
206+ return nil
207+ }
200208 }
201209
202210 if task .IsForkPullRequest {
Original file line number Diff line number Diff line change 1+ // Copyright 2024 The Gitea Authors. All rights reserved.
2+ // SPDX-License-Identifier: MIT
3+
4+ package setting
5+
6+ import (
7+ "net/http"
8+
9+ "code.gitea.io/gitea/modules/base"
10+ "code.gitea.io/gitea/services/context"
11+ )
12+
13+ const (
14+ tplRepoActionsGeneral base.TplName = "repo/settings/actions"
15+ )
16+
17+ func ActionsGeneral (ctx * context.Context ) {
18+ ctx .Data ["Title" ] = ctx .Tr ("actions.general" )
19+ ctx .Data ["PageType" ] = "general"
20+ ctx .Data ["PageIsActionsSettingsGeneral" ] = true
21+
22+ ctx .HTML (http .StatusOK , tplRepoActionsGeneral )
23+ }
Original file line number Diff line number Diff line change @@ -1133,6 +1133,7 @@ func registerRoutes(m *web.Router) {
11331133 addSettingsRunnersRoutes ()
11341134 addSettingsSecretsRoutes ()
11351135 addSettingsVariablesRoutes ()
1136+ m .Get ("/general" , repo_setting .ActionsGeneral )
11361137 }, actions .MustEnableActions )
11371138 // the follow handler must be under "settings", otherwise this incomplete repo can't be accessed
11381139 m .Group ("/migrate" , func () {
Original file line number Diff line number Diff line change 66 {{template "shared/secrets/add_list" .}}
77 {{else if eq .PageType "variables"}}
88 {{template "shared/variables/variable_list" .}}
9+ {{else if eq .PageType "general"}}
10+ {{template "repo/settings/actions_general" .}}
911 {{end}}
1012 </div>
1113{{template "repo/settings/layout_footer" .}}
Original file line number Diff line number Diff line change 1+ <div class="repo-setting-content">
2+ <h4 class="ui top attached header">
3+ {{ctx.Locale.Tr "actions.general.settings"}}
4+ </h4>
5+ <div class="ui attached segment">
6+ <form class="ui form" method="post">
7+ <div id="actions_accessible_from_other_repositories_box" class="field">
8+ <div class="ui checkbox">
9+ <input id="actions_accessible_from_other_repositories" name="actions_accessible_from_other_repositories" type="checkbox">
10+ <label>{{ctx.Locale.Tr "actions.general.actions_accessible_from_other_repositories" .Owner.Name}}</label>
11+ <p class="help">{{ctx.Locale.Tr "actions.general.actions_accessible_from_other_repositories_desc" .Owner.Name}}</p>
12+ </div>
13+ </div>
14+ </form>
15+ </div>
16+ </div>
Original file line number Diff line number Diff line change 3434 {{end}}
3535 {{end}}
3636 {{if and .EnableActions (.Permission.CanRead ctx.Consts.RepoUnitTypeActions)}}
37- <details class="item toggleable-item" {{if or .PageIsSharedSettingsRunners .PageIsSharedSettingsSecrets .PageIsSharedSettingsVariables}}open{{end}}>
37+ <details class="item toggleable-item" {{if or .PageIsSharedSettingsRunners .PageIsSharedSettingsSecrets .PageIsSharedSettingsVariables .PageIsActionsSettingsGeneral }}open{{end}}>
3838 <summary>{{ctx.Locale.Tr "actions.actions"}}</summary>
3939 <div class="menu">
4040 <a class="{{if .PageIsSharedSettingsRunners}}active {{end}}item" href="{{.RepoLink}}/settings/actions/runners">
4646 <a class="{{if .PageIsSharedSettingsVariables}}active {{end}}item" href="{{.RepoLink}}/settings/actions/variables">
4747 {{ctx.Locale.Tr "actions.variables"}}
4848 </a>
49+ <a class="{{if .PageIsActionsSettingsGeneral}}active {{end}}item" href="{{.RepoLink}}/settings/actions/general">
50+ {{ctx.Locale.Tr "actions.general"}}
51+ </a>
4952 </div>
5053 </details>
5154 {{end}}
You can’t perform that action at this time.
0 commit comments