Skip to content

Commit bc71cc4

Browse files
committed
improvements for public repos
1 parent 96e8667 commit bc71cc4

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

options/locale/locale_en-US.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3758,6 +3758,7 @@ general = General
37583758
general.settings = Actions General Settings
37593759
general.actions_accessible_from_other_repositories = Accessible from repositories owned by '%s'
37603760
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.
3761+
general.actions_always_accessible_desc = The actions and workflows of a public repository are always accessible to other repositories.
37613762

37623763
[projects]
37633764
deleted.display_name = Deleted Project

routers/web/repo/setting/actions.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,18 @@ func ActionsGeneralSettings(ctx *context.Context) {
1919
ctx.Data["PageType"] = "general"
2020
ctx.Data["PageIsActionsSettingsGeneral"] = true
2121

22-
actionsUnit, err := ctx.Repo.Repository.GetUnit(ctx, unit_model.TypeActions)
23-
if err != nil {
24-
ctx.ServerError("GetUnit", err)
25-
return
22+
accessbleFromOtherRepos := false
23+
if !ctx.Repo.Repository.IsPrivate {
24+
accessbleFromOtherRepos = true
25+
} else {
26+
actionsUnit, err := ctx.Repo.Repository.GetUnit(ctx, unit_model.TypeActions)
27+
if err != nil {
28+
ctx.ServerError("GetUnit", err)
29+
return
30+
}
31+
accessbleFromOtherRepos = actionsUnit.ActionsConfig().AccessbleFromOtherRepos
2632
}
27-
actionsCfg := actionsUnit.ActionsConfig()
28-
29-
ctx.Data["AccessibleFromOtherRepos"] = actionsCfg.AccessbleFromOtherRepos
33+
ctx.Data["AccessibleFromOtherRepos"] = accessbleFromOtherRepos
3034

3135
ctx.HTML(http.StatusOK, tplRepoActionsGeneralSettings)
3236
}

templates/repo/settings/actions_general.tmpl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,15 @@
77
{{.CsrfTokenHtml}}
88
<div id="actions_accessible_from_other_repositories_box" class="field">
99
<div class="ui checkbox">
10-
<input id="actions_accessible_from_other_repositories" name="actions_accessible_from_other_repositories" type="checkbox" {{if .AccessibleFromOtherRepos}}checked{{end}}>
10+
<input id="actions_accessible_from_other_repositories" name="actions_accessible_from_other_repositories" type="checkbox" {{if not .Repository.IsPrivate}}disabled{{end}} {{if .AccessibleFromOtherRepos}}checked{{end}}>
1111
<label>{{ctx.Locale.Tr "actions.general.actions_accessible_from_other_repositories" .Owner.Name}}</label>
12-
<p class="help">{{ctx.Locale.Tr "actions.general.actions_accessible_from_other_repositories_desc" .Owner.Name}}</p>
12+
<p class="help">
13+
{{if .Repository.IsPrivate}}
14+
{{ctx.Locale.Tr "actions.general.actions_accessible_from_other_repositories_desc" .Owner.Name}}
15+
{{else}}
16+
{{ctx.Locale.Tr "actions.general.actions_always_accessible_desc"}}
17+
{{end}}
18+
</p>
1319
</div>
1420
</div>
1521
<div class="divider"></div>

0 commit comments

Comments
 (0)