-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Support actions and reusable workflows from private repos #32562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Zettat123
wants to merge
24
commits into
go-gitea:main
Choose a base branch
from
Zettat123:private-reusable-workflow
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 9 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
833def9
actions from private repos
Zettat123 f73073d
add ActionsGeneralSettingsPost
Zettat123 73b00ea
misc
Zettat123 8fcf1b6
lint
Zettat123 77973f1
Merge branch 'main' into private-reusable-workflow
Zettat123 96e8667
Merge branch 'main' into private-reusable-workflow
Zettat123 bc71cc4
improvements for public repos
Zettat123 9ae5093
lint
Zettat123 55cb6ab
Merge branch 'main' into private-reusable-workflow
Zettat123 6b2434f
Merge branch 'main' into private-reusable-workflow
Zettat123 6142f66
use CollaborativeOwnerIDs
Zettat123 301c4b4
Merge branch 'main' into private-reusable-workflow
Zettat123 baf3839
improve ui
Zettat123 5a033a0
Merge branch 'main' into private-reusable-workflow
Zettat123 e7c6adb
add LoadRepository for task
Zettat123 af8033d
lint
Zettat123 cbaa5ff
Merge branch 'main' into private-reusable-workflow
Zettat123 527998d
fix repo
Zettat123 1856b32
fix task LoadAttributes
Zettat123 0180d92
lint
Zettat123 fe95ba8
add TestActionsCollaborativeOwner
Zettat123 6bab53a
edit test commit
Zettat123 d46a201
Merge branch 'main' into private-reusable-workflow
Zettat123 c76e821
Merge branch 'main' into private-reusable-workflow
Zettat123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright 2024 The Gitea Authors. All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package setting | ||
|
||
import ( | ||
"net/http" | ||
|
||
repo_model "code.gitea.io/gitea/models/repo" | ||
unit_model "code.gitea.io/gitea/models/unit" | ||
"code.gitea.io/gitea/modules/base" | ||
"code.gitea.io/gitea/services/context" | ||
) | ||
|
||
const tplRepoActionsGeneralSettings base.TplName = "repo/settings/actions" | ||
|
||
func ActionsGeneralSettings(ctx *context.Context) { | ||
ctx.Data["Title"] = ctx.Tr("actions.general") | ||
ctx.Data["PageType"] = "general" | ||
ctx.Data["PageIsActionsSettingsGeneral"] = true | ||
|
||
var accessbleFromOtherRepos bool | ||
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 | ||
} | ||
ctx.Data["AccessibleFromOtherRepos"] = accessbleFromOtherRepos | ||
|
||
ctx.HTML(http.StatusOK, tplRepoActionsGeneralSettings) | ||
} | ||
|
||
func ActionsGeneralSettingsPost(ctx *context.Context) { | ||
actionsUnit, err := ctx.Repo.Repository.GetUnit(ctx, unit_model.TypeActions) | ||
if err != nil { | ||
ctx.ServerError("GetUnit", err) | ||
return | ||
} | ||
actionsCfg := actionsUnit.ActionsConfig() | ||
actionsCfg.AccessbleFromOtherRepos = ctx.FormBool("actions_accessible_from_other_repositories") | ||
|
||
if err := repo_model.UpdateRepoUnit(ctx, actionsUnit); err != nil { | ||
ctx.ServerError("UpdateRepoUnit", err) | ||
return | ||
} | ||
|
||
ctx.Redirect(ctx.Repo.RepoLink + "/settings/actions/general") | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<div class="repo-setting-content"> | ||
<h4 class="ui top attached header"> | ||
{{ctx.Locale.Tr "actions.general.settings"}} | ||
</h4> | ||
<div class="ui attached segment"> | ||
<form class="ui form" action="{{.Link}}" method="post"> | ||
{{.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 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"> | ||
{{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> | ||
<div class="field"> | ||
<button class="ui primary button">{{ctx.Locale.Tr "save"}}</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.