improvements for public repos

This commit is contained in:
Zettat123 2024-11-22 16:03:54 +08:00
parent 96e8667a9e
commit bc71cc4fc0
3 changed files with 20 additions and 9 deletions

View File

@ -3758,6 +3758,7 @@ general = General
general.settings = Actions General Settings
general.actions_accessible_from_other_repositories = Accessible from repositories owned by '%s'
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.
general.actions_always_accessible_desc = The actions and workflows of a public repository are always accessible to other repositories.
[projects]
deleted.display_name = Deleted Project

View File

@ -19,14 +19,18 @@ func ActionsGeneralSettings(ctx *context.Context) {
ctx.Data["PageType"] = "general"
ctx.Data["PageIsActionsSettingsGeneral"] = true
actionsUnit, err := ctx.Repo.Repository.GetUnit(ctx, unit_model.TypeActions)
if err != nil {
ctx.ServerError("GetUnit", err)
return
accessbleFromOtherRepos := false
if !ctx.Repo.Repository.IsPrivate {
accessbleFromOtherRepos = true
} else {
actionsUnit, err := ctx.Repo.Repository.GetUnit(ctx, unit_model.TypeActions)
if err != nil {
ctx.ServerError("GetUnit", err)
return
}
accessbleFromOtherRepos = actionsUnit.ActionsConfig().AccessbleFromOtherRepos
}
actionsCfg := actionsUnit.ActionsConfig()
ctx.Data["AccessibleFromOtherRepos"] = actionsCfg.AccessbleFromOtherRepos
ctx.Data["AccessibleFromOtherRepos"] = accessbleFromOtherRepos
ctx.HTML(http.StatusOK, tplRepoActionsGeneralSettings)
}

View File

@ -7,9 +7,15 @@
{{.CsrfTokenHtml}}
<div id="actions_accessible_from_other_repositories_box" class="field">
<div class="ui checkbox">
<input id="actions_accessible_from_other_repositories" name="actions_accessible_from_other_repositories" type="checkbox" {{if .AccessibleFromOtherRepos}}checked{{end}}>
<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}}>
<label>{{ctx.Locale.Tr "actions.general.actions_accessible_from_other_repositories" .Owner.Name}}</label>
<p class="help">{{ctx.Locale.Tr "actions.general.actions_accessible_from_other_repositories_desc" .Owner.Name}}</p>
<p class="help">
{{if .Repository.IsPrivate}}
{{ctx.Locale.Tr "actions.general.actions_accessible_from_other_repositories_desc" .Owner.Name}}
{{else}}
{{ctx.Locale.Tr "actions.general.actions_always_accessible_desc"}}
{{end}}
</p>
</div>
</div>
<div class="divider"></div>