This commit is contained in:
Zettat123 2024-11-20 14:15:08 +08:00
parent f73073df41
commit 73b00ea10e
2 changed files with 7 additions and 5 deletions

View File

@ -195,13 +195,17 @@ func httpBase(ctx *context.Context) *serviceHandler {
return nil return nil
} }
if task.RepoID != repo.ID { if task.RepoID != repo.ID {
actionsCfg := repo.MustGetUnit(ctx, unit.TypeActions).ActionsConfig()
taskRepo, err := repo_model.GetRepositoryByID(ctx, task.RepoID) taskRepo, err := repo_model.GetRepositoryByID(ctx, task.RepoID)
if err != nil { if err != nil {
ctx.ServerError("GetRepositoryByID", err) ctx.ServerError("GetRepositoryByID", err)
return nil return nil
} }
actionsCfg := repo.MustGetUnit(ctx, unit.TypeActions).ActionsConfig() if !actionsCfg.AccessbleFromOtherRepos || taskRepo.OwnerID != repo.OwnerID || !taskRepo.IsPrivate {
if !taskRepo.IsPrivate || taskRepo.OwnerID != repo.OwnerID || !actionsCfg.AccessbleFromOtherRepos { // See https://docs.github.com/en/actions/sharing-automations/sharing-actions-and-workflows-from-your-private-repository
// Any actions or reusable workflows stored in the private repository can be used in
// workflows defined in other private repositories owned by the same organization or user.
// Actions and reusable workflows stored in private repositories cannot be used in public repositories.
ctx.PlainText(http.StatusForbidden, "User permission denied") ctx.PlainText(http.StatusForbidden, "User permission denied")
return nil return nil
} }

View File

@ -12,9 +12,7 @@ import (
"code.gitea.io/gitea/services/context" "code.gitea.io/gitea/services/context"
) )
const ( const tplRepoActionsGeneralSettings base.TplName = "repo/settings/actions"
tplRepoActionsGeneralSettings base.TplName = "repo/settings/actions"
)
func ActionsGeneralSettings(ctx *context.Context) { func ActionsGeneralSettings(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("actions.general") ctx.Data["Title"] = ctx.Tr("actions.general")