2023-04-23 06:21:21 -04:00
{{ template "repo/settings/layout_head" ( dict "ctxData" . "pageClass" "repository settings options" ) }}
< div class = "user-main-content twelve wide column" >
2017-03-15 18:39:38 -04:00
< h4 class = "ui top attached header" >
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.basic_settings" }}
2017-03-15 18:39:38 -04:00
< / h4 >
< div class = "ui attached segment" >
< form class = "ui form" action = " {{ .Link }} " method = "post" >
2021-10-18 18:08:41 -04:00
{{ template "base/disable_form_autofill" }}
2017-03-15 18:39:38 -04:00
{{ .CsrfTokenHtml }}
< input type = "hidden" name = "action" value = "update" >
< div class = "required field {{ if .Err_RepoName }} error {{ end }} " >
2023-09-25 04:56:50 -04:00
< label for = "repo_name" > {{ ctx .Locale.Tr "repo.repo_name" }} </ label >
2017-03-15 18:39:38 -04:00
< input id = "repo_name" name = "repo_name" value = " {{ .Repository.Name }} " data-repo-name = " {{ .Repository.Name }} " autofocus required >
< / div >
2019-11-12 19:45:19 -05:00
< div class = "inline field" >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.repo_size" }} </ label >
2023-06-28 18:41:02 -04:00
< span {{ if not ( eq .Repository.Size 0 ) }} data-tooltip-content = " {{ .Repository.SizeDetailsString }} " {{ end }} > {{ FileSize .Repository.Size }} </ span >
2019-11-12 19:45:19 -05:00
< / div >
2019-11-11 10:15:29 -05:00
< div class = "inline field" >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.template" }} </ label >
2019-11-11 10:15:29 -05:00
< div class = "ui checkbox" >
< input name = "template" type = "checkbox" {{ if .Repository.IsTemplate }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.template_helper" }} </ label >
2019-11-11 10:15:29 -05:00
< / div >
< / div >
2017-03-15 18:39:38 -04:00
{{ if not .Repository.IsFork }}
< div class = "inline field" >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.visibility" }} </ label >
< div class = "ui checkbox" {{ if and ( not .Repository.IsPrivate ) ( gt .Repository.NumStars 0 ) }} data-tooltip-content = " {{ ctx .Locale.Tr "repo.stars_remove_warning" }} " {{ end }} >
2019-04-11 04:32:42 -04:00
{{ if .IsAdmin }}
< input name = "private" type = "checkbox" {{ if .Repository.IsPrivate }} checked {{ end }} >
{{ else }}
2019-02-22 16:56:05 -05:00
< input name = "private" type = "checkbox" {{ if .Repository.IsPrivate }} checked {{ end }}{{ if and $.ForcePrivate .Repository.IsPrivate }} readonly {{ end }} >
2019-04-11 04:32:42 -04:00
{{ end }}
2023-09-25 08:42:40 -04:00
< label > {{ ctx .Locale.Tr "repo.visibility_helper" | Safe }} {{ if .Repository.NumForks }} < span class = "text red" > {{ ctx .Locale.Tr "repo.visibility_fork_helper" }} </ span > {{ end }} </ label >
2017-02-21 10:02:10 -05:00
< / div >
2017-03-15 18:39:38 -04:00
< / div >
{{ end }}
< div class = "field {{ if .Err_Description }} error {{ end }} " >
2023-09-25 04:56:50 -04:00
< label for = "description" > {{ ctx .Locale.Tr "repo.repo_desc" }} </ label >
2022-09-16 03:19:16 -04:00
< textarea id = "description" name = "description" rows = "2" maxlength = "2048" > {{ .Repository.Description }} </ textarea >
2017-03-15 18:39:38 -04:00
< / div >
< div class = "field {{ if .Err_Website }} error {{ end }} " >
2023-09-25 04:56:50 -04:00
< label for = "website" > {{ ctx .Locale.Tr "repo.settings.site" }} </ label >
2022-09-16 03:19:16 -04:00
< input id = "website" name = "website" type = "url" maxlength = "1024" value = " {{ .Repository.Website }} " >
2017-03-15 18:39:38 -04:00
< / div >
< div class = "field" >
2023-09-25 04:56:50 -04:00
< button class = "ui primary button" > {{ ctx .Locale.Tr "repo.settings.update_settings" }} </ button >
2016-08-30 19:18:33 -04:00
< / div >
2017-03-15 18:39:38 -04:00
< / form >
2019-05-29 22:22:26 -04:00
2023-06-29 08:24:22 -04:00
< div class = "divider" > < / div >
2019-05-29 22:22:26 -04:00
< form class = "ui form" action = " {{ .Link }} /avatar" method = "post" enctype = "multipart/form-data" >
{{ .CsrfTokenHtml }}
< div class = "inline field" >
2023-09-25 04:56:50 -04:00
< label for = "avatar" > {{ ctx .Locale.Tr "settings.choose_new_avatar" }} </ label >
2023-04-21 17:58:59 -04:00
< input name = "avatar" type = "file" accept = "image/png,image/jpeg,image/gif,image/webp" >
2019-05-29 22:22:26 -04:00
< / div >
< div class = "field" >
2023-09-25 04:56:50 -04:00
< button class = "ui primary button" > {{ ctx .Locale.Tr "settings.update_avatar" }} </ button >
< button class = "ui red button link-action" data-url = " {{ .Link }} /avatar/delete" > {{ ctx .Locale.Tr "settings.delete_current_avatar" }} </ button >
2019-05-29 22:22:26 -04:00
< / div >
< / form >
2017-03-15 18:39:38 -04:00
< / div >
2016-08-30 19:18:33 -04:00
2023-05-29 07:32:52 -04:00
{{/* These variables exist to make the logic in the Settings window easier to comprehend and are not used later on. */}}
{{ $newMirrorsPartiallyEnabled := or ( not .DisableNewPullMirrors ) ( not .DisableNewPushMirrors ) }}
{{/* .Repository.IsMirror is not always reliable if the repository is not actively acting as a mirror because of errors. */}}
2024-01-10 06:55:59 -05:00
{{ $showMirrorSettings := and ( .Repository.UnitEnabled $.Context $.UnitTypeCode ) ( or $newMirrorsPartiallyEnabled .Repository.IsMirror .PullMirror .PushMirrors ) }}
2023-05-29 07:32:52 -04:00
{{ $newMirrorsEntirelyEnabled := and ( not .DisableNewPullMirrors ) ( not .DisableNewPushMirrors ) }}
{{ $onlyNewPushMirrorsEnabled := and ( not .DisableNewPushMirrors ) .DisableNewPullMirrors }}
{{ $onlyNewPullMirrorsEnabled := and .DisableNewPushMirrors ( not .DisableNewPullMirrors ) }}
{{ $existingPushMirror := or .Repository.IsMirror .PushMirrors }}
{{ $modifyBrokenPullMirror := and .Repository.IsMirror ( not .PullMirror ) }}
{{ $isWorkingPullMirror := .PullMirror }}
{{ if $showMirrorSettings }}
2017-03-15 18:39:38 -04:00
< h4 class = "ui top attached header" >
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.mirror_settings" }}
2017-03-15 18:39:38 -04:00
< / h4 >
< div class = "ui attached segment" >
2024-01-23 21:32:57 -05:00
{{ if .Repository.IsArchived }}
< div class = "ui warning message gt-text-center" >
{{ ctx .Locale.Tr "repo.settings.archive.mirrors_unavailable" }}
< / div >
2023-05-29 07:32:52 -04:00
{{ else }}
2024-01-23 21:32:57 -05:00
{{ if $newMirrorsEntirelyEnabled }}
{{ ctx .Locale.Tr "repo.settings.mirror_settings.docs" }}
< a target = "_blank" rel = "noopener noreferrer" href = "https://docs.gitea.com/usage/repo-mirror#pushing-to-a-remote-repository" > {{ ctx .Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title" }} </ a >< br >< br >
{{ ctx .Locale.Tr "repo.settings.mirror_settings.docs.pull_mirror_instructions" }}
< a target = "_blank" rel = "noopener noreferrer" href = "https://docs.gitea.com/usage/repo-mirror#pulling-from-a-remote-repository" > {{ ctx .Locale.Tr "repo.settings.mirror_settings.docs.doc_link_pull_section" }} </ a >< br >
{{ else if $onlyNewPushMirrorsEnabled }}
{{ ctx .Locale.Tr "repo.settings.mirror_settings.docs.disabled_pull_mirror.instructions" }}
{{ ctx .Locale.Tr "repo.settings.mirror_settings.docs.more_information_if_disabled" }}
< a target = "_blank" rel = "noopener noreferrer" href = "https://docs.gitea.com/usage/repo-mirror#pulling-from-a-remote-repository" > {{ ctx .Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title" }} </ a >< br >
{{ else if $onlyNewPullMirrorsEnabled }}
{{ ctx .Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.instructions" }}
{{ ctx .Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.pull_mirror_warning" }}
{{ ctx .Locale.Tr "repo.settings.mirror_settings.docs.more_information_if_disabled" }}
< a target = "_blank" rel = "noopener noreferrer" href = "https://docs.gitea.com/usage/repo-mirror#pulling-from-a-remote-repository" > {{ ctx .Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title" }} </ a >< br >< br >
{{ ctx .Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.info" }}
{{ if $existingPushMirror }}
{{ ctx .Locale.Tr "repo.settings.mirror_settings.docs.can_still_use" }}
{{ end }}
{{ else }}
{{ ctx .Locale.Tr "repo.settings.mirror_settings.docs.no_new_mirrors" }} {{ ctx .Locale.Tr "repo.settings.mirror_settings.docs.can_still_use" }} < br >
2021-04-08 18:25:57 -04:00
{{ end }}
2024-01-31 19:04:23 -05:00
{{ if .Repository.IsMirror }}
2024-01-23 21:32:57 -05:00
< table class = "ui table" >
< thead >
< tr >
< th style = "width:40%" > {{ ctx .Locale.Tr "repo.settings.mirror_settings.mirrored_repository" }} </ th >
< th > {{ ctx .Locale.Tr "repo.settings.mirror_settings.direction" }} </ th >
< th > {{ ctx .Locale.Tr "repo.settings.mirror_settings.last_update" }} </ th >
< th > < / th >
< / tr >
< / thead >
{{ end }}
{{ if $modifyBrokenPullMirror }}
{{/* even if a repo is a pull mirror (IsMirror=true), the PullMirror might still be nil if the mirror migration is broken */}}
< tbody >
< tr >
< td colspan = "4" >
< div class = "text red gt-py-4 gt-border-secondary-bottom" > {{ ctx .Locale.Tr "repo.settings.mirror_settings.direction.pull" }} : {{ ctx .Locale.Tr "error.occurred" }} </ div >
< / td >
< / tr >
< / tbody >
{{ else if $isWorkingPullMirror }}
2023-05-15 15:02:10 -04:00
< tbody >
< tr >
2024-01-23 21:32:57 -05:00
< td > {{ .PullMirror.RemoteAddress }} </ td >
< td > {{ ctx .Locale.Tr "repo.settings.mirror_settings.direction.pull" }} </ td >
< td > {{ DateTime "full" .PullMirror.UpdatedUnix }} </ td >
< td class = "right aligned" >
< form method = "post" class = "gt-dib" >
{{ .CsrfTokenHtml }}
< input type = "hidden" name = "action" value = "mirror-sync" >
< button class = "ui primary tiny button inline text-thin" > {{ ctx .Locale.Tr "repo.settings.sync_mirror" }} </ button >
< / form >
2023-05-15 15:02:10 -04:00
< / td >
< / tr >
2021-09-07 11:49:36 -04:00
< tr >
< td colspan = "4" >
< form class = "ui form" method = "post" >
2021-10-18 18:08:41 -04:00
{{ template "base/disable_form_autofill" }}
2021-09-07 11:49:36 -04:00
{{ .CsrfTokenHtml }}
2024-01-23 21:32:57 -05:00
< input type = "hidden" name = "action" value = "mirror" >
< div class = "inline field {{ if .Err_EnablePrune }} error {{ end }} " >
< label > {{ ctx .Locale.Tr "repo.mirror_prune" }} </ label >
< div class = "ui checkbox" >
< input id = "enable_prune" name = "enable_prune" type = "checkbox" {{ if .PullMirror.EnablePrune }} checked {{ end }} >
< label > {{ ctx .Locale.Tr "repo.mirror_prune_desc" }} </ label >
< / div >
< / div >
< div class = "inline field {{ if .Err_Interval }} error {{ end }} " >
< label for = "interval" > {{ ctx .Locale.Tr "repo.mirror_interval" .MinimumMirrorInterval }} </ label >
< input id = "interval" name = "interval" value = " {{ .PullMirror.Interval }} " >
< / div >
{{ $address := MirrorRemoteAddress $.Context .Repository .PullMirror.GetRemoteName false }}
< div class = "field {{ if .Err_MirrorAddress }} error {{ end }} " >
< label for = "mirror_address" > {{ ctx .Locale.Tr "repo.mirror_address" }} </ label >
< input id = "mirror_address" name = "mirror_address" value = " {{ $address .Address }} " required >
2023-09-25 04:56:50 -04:00
< p class = "help" > {{ ctx .Locale.Tr "repo.mirror_address_desc" }} </ p >
2021-09-07 11:49:36 -04:00
< / div >
2024-01-23 21:32:57 -05:00
< details class = "ui optional field" {{ if or .Err_Auth $address .Username }} open {{ end }} >
2023-02-13 12:59:59 -05:00
< summary class = "gt-p-2" >
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.need_auth" }}
2021-09-07 11:49:36 -04:00
< / summary >
2023-02-13 12:59:59 -05:00
< div class = "gt-p-2" >
2024-01-23 21:32:57 -05:00
< div class = "inline field {{ if .Err_Auth }} error {{ end }} " >
< label for = "mirror_username" > {{ ctx .Locale.Tr "username" }} </ label >
< input id = "mirror_username" name = "mirror_username" value = " {{ $address .Username }} " {{ if not .mirror_username }} data-need-clear = "true" {{ end }} >
2021-09-07 11:49:36 -04:00
< / div >
2024-01-23 21:32:57 -05:00
< div class = "inline field {{ if .Err_Auth }} error {{ end }} " >
< label for = "mirror_password" > {{ ctx .Locale.Tr "password" }} </ label >
< input id = "mirror_password" name = "mirror_password" type = "password" placeholder = " {{ if $address .Password }}{{ ctx .Locale.Tr "repo.mirror_password_placeholder" }}{{ else }}{{ ctx .Locale.Tr "repo.mirror_password_blank_placeholder" }}{{ end }} " value = "" {{ if not .mirror_password }} data-need-clear = "true" {{ end }} autocomplete = "off" >
2021-09-07 11:49:36 -04:00
< / div >
2024-01-23 21:32:57 -05:00
< p class = "help" > {{ ctx .Locale.Tr "repo.mirror_password_help" }} </ p >
2021-06-14 13:20:43 -04:00
< / div >
2021-09-07 11:49:36 -04:00
< / details >
2024-01-23 21:32:57 -05:00
{{ if .LFSStartServer }}
< div class = "inline field" >
< label > {{ ctx .Locale.Tr "repo.mirror_lfs" }} </ label >
2022-07-08 15:45:12 -04:00
< div class = "ui checkbox" >
2024-01-23 21:32:57 -05:00
< input id = "mirror_lfs" name = "mirror_lfs" type = "checkbox" {{ if .PullMirror.LFS }} checked {{ end }} >
< label > {{ ctx .Locale.Tr "repo.mirror_lfs_desc" }} </ label >
2022-07-08 15:45:12 -04:00
< / div >
< / div >
2024-01-23 21:32:57 -05:00
< div class = "field {{ if .Err_LFSEndpoint }} error {{ end }} " >
< label for = "mirror_lfs_endpoint" > {{ ctx .Locale.Tr "repo.mirror_lfs_endpoint" }} </ label >
< input id = "mirror_lfs_endpoint" name = "mirror_lfs_endpoint" value = " {{ .PullMirror.LFSEndpoint }} " placeholder = " {{ ctx .Locale.Tr "repo.migrate_options_lfs_endpoint.placeholder" }} " >
< p class = "help" > {{ ctx .Locale.Tr "repo.mirror_lfs_endpoint_desc" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery" | Str2html }} </ p >
2021-06-14 13:20:43 -04:00
< / div >
2024-01-23 21:32:57 -05:00
{{ end }}
2021-09-07 11:49:36 -04:00
< div class = "field" >
2024-01-23 21:32:57 -05:00
< button class = "ui primary button" > {{ ctx .Locale.Tr "repo.settings.update_mirror_settings" }} </ button >
2021-09-07 11:49:36 -04:00
< / div >
< / form >
< / td >
< / tr >
2024-01-23 21:32:57 -05:00
< / tbody >
2024-01-31 19:04:23 -05:00
< / table >
{{ end }} {{/* end if: IsMirror */}}
< table class = "ui table" >
< thead >
< tr >
< th style = "width:40%" > {{ ctx .Locale.Tr "repo.settings.mirror_settings.pushed_repository" }} </ th >
< th > {{ ctx .Locale.Tr "repo.settings.mirror_settings.direction" }} </ th >
< th > {{ ctx .Locale.Tr "repo.settings.mirror_settings.last_update" }} </ th >
< th > < / th >
< / tr >
< / thead >
2024-01-23 21:32:57 -05:00
< tbody >
{{ range .PushMirrors }}
< tr >
< td class = "gt-word-break" > {{ .RemoteAddress }} </ td >
< td > {{ ctx .Locale.Tr "repo.settings.mirror_settings.direction.push" }} </ td >
< td > {{ if .LastUpdateUnix }}{{ DateTime "full" .LastUpdateUnix }}{{ else }}{{ ctx .Locale.Tr "never" }}{{ end }} {{ if .LastError }} < div class = "ui red label" data-tooltip-content = " {{ .LastError }} " > {{ ctx .Locale.Tr "error" }} </ div > {{ end }} </ td >
< td class = "right aligned" >
< button
class="ui tiny button show-modal"
data-modal="#push-mirror-edit-modal"
data-tooltip-content="{{ ctx .Locale.Tr "repo.settings.mirror_settings.push_mirror.edit_sync_time" }} "
data-modal-push-mirror-edit-id="{{ .ID }} "
data-modal-push-mirror-edit-interval="{{ .Interval }} "
data-modal-push-mirror-edit-address="{{ .RemoteAddress }} "
>
{{ svg "octicon-pencil" 14 }}
< / button >
< form method = "post" class = "gt-dib" >
{{ $.CsrfTokenHtml }}
< input type = "hidden" name = "action" value = "push-mirror-sync" >
< input type = "hidden" name = "push_mirror_id" value = " {{ .ID }} " >
< button class = "ui primary tiny button" data-tooltip-content = " {{ ctx .Locale.Tr "repo.settings.sync_mirror" }} " > {{ svg "octicon-sync" 14 }} </ button >
< / form >
< form method = "post" class = "gt-dib" >
{{ $.CsrfTokenHtml }}
< input type = "hidden" name = "action" value = "push-mirror-remove" >
< input type = "hidden" name = "push_mirror_id" value = " {{ .ID }} " >
< button class = "ui basic red tiny button" data-tooltip-content = " {{ ctx .Locale.Tr "remove" }} " > {{ svg "octicon-trash" 14 }} </ button >
< / form >
< / td >
< / tr >
{{ else }}
< tr >
< td > {{ ctx .Locale.Tr "repo.settings.mirror_settings.push_mirror.none" }} </ td >
< / tr >
{{ end }}
{{ if ( not .DisableNewPushMirrors ) }}
< tr >
< td colspan = "4" >
< form class = "ui form" method = "post" >
{{ template "base/disable_form_autofill" }}
{{ .CsrfTokenHtml }}
< input type = "hidden" name = "action" value = "push-mirror-add" >
< div class = "field {{ if .Err_PushMirrorAddress }} error {{ end }} " >
< label for = "push_mirror_address" > {{ ctx .Locale.Tr "repo.settings.mirror_settings.push_mirror.remote_url" }} </ label >
< input id = "push_mirror_address" name = "push_mirror_address" value = " {{ .push_mirror_address }} " required >
< p class = "help" > {{ ctx .Locale.Tr "repo.mirror_address_desc" }} </ p >
< / div >
< details class = "ui optional field" {{ if or .Err_PushMirrorAuth .push_mirror_username }} open {{ end }} >
< summary class = "gt-p-2" >
{{ ctx .Locale.Tr "repo.need_auth" }}
< / summary >
< div class = "gt-p-2" >
< div class = "inline field {{ if .Err_PushMirrorAuth }} error {{ end }} " >
< label for = "push_mirror_username" > {{ ctx .Locale.Tr "username" }} </ label >
< input id = "push_mirror_username" name = "push_mirror_username" value = " {{ .push_mirror_username }} " >
< / div >
< div class = "inline field {{ if .Err_PushMirrorAuth }} error {{ end }} " >
< label for = "push_mirror_password" > {{ ctx .Locale.Tr "password" }} </ label >
< input id = "push_mirror_password" name = "push_mirror_password" type = "password" value = " {{ .push_mirror_password }} " autocomplete = "off" >
< / div >
< / div >
< / details >
< div class = "field" >
< div class = "ui checkbox" >
< input id = "push_mirror_sync_on_commit" name = "push_mirror_sync_on_commit" type = "checkbox" {{ if .push_mirror_sync_on_commit }} checked {{ end }} >
< label for = "push_mirror_sync_on_commit" > {{ ctx .Locale.Tr "repo.mirror_sync_on_commit" }} </ label >
< / div >
< / div >
< div class = "inline field {{ if .Err_PushMirrorInterval }} error {{ end }} " >
< label for = "push_mirror_interval" > {{ ctx .Locale.Tr "repo.mirror_interval" .MinimumMirrorInterval }} </ label >
< input id = "push_mirror_interval" name = "push_mirror_interval" value = " {{ if .push_mirror_interval }}{{ .push_mirror_interval }}{{ else }}{{ .DefaultMirrorInterval }}{{ end }} " >
< / div >
< div class = "field" >
< button class = "ui primary button" > {{ ctx .Locale.Tr "repo.settings.mirror_settings.push_mirror.add" }} </ button >
< / div >
< / form >
< / td >
< / tr >
{{ end }}
< / tbody >
< / table >
{{ end }}
2017-03-15 18:39:38 -04:00
< / div >
{{ end }}
2015-12-07 17:30:52 -05:00
2017-03-15 18:39:38 -04:00
< h4 class = "ui top attached header" >
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.advanced_settings" }}
2017-03-15 18:39:38 -04:00
< / h4 >
< div class = "ui attached segment" >
< form class = "ui form" method = "post" >
{{ .CsrfTokenHtml }}
< input type = "hidden" name = "action" value = "advanced" >
2015-12-07 17:30:52 -05:00
2022-12-12 00:29:27 -05:00
{{ $isCodeEnabled := .Repository.UnitEnabled $.Context $.UnitTypeCode }}
2023-06-14 14:17:58 -04:00
{{ $isCodeGlobalDisabled := .UnitTypeCode.UnitGlobalDisabled }}
2022-12-12 00:29:27 -05:00
< div class = "inline field" >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.code" }} </ label >
< div class = "ui checkbox {{ if $isCodeGlobalDisabled }} disabled {{ end }} " {{ if $isCodeGlobalDisabled }} data-tooltip-content = " {{ ctx .Locale.Tr "repo.unit_disabled" }} " {{ end }} >
2022-12-12 00:29:27 -05:00
< input class = "enable-system" name = "enable_code" type = "checkbox" {{ if $isCodeEnabled }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.code.desc" }} </ label >
2022-12-12 00:29:27 -05:00
< / div >
< / div >
2022-12-09 21:46:31 -05:00
{{ $isWikiEnabled := or ( .Repository.UnitEnabled $.Context $.UnitTypeWiki ) ( .Repository.UnitEnabled $.Context $.UnitTypeExternalWiki ) }}
2023-06-14 14:17:58 -04:00
{{ $isWikiGlobalDisabled := .UnitTypeWiki.UnitGlobalDisabled }}
{{ $isExternalWikiGlobalDisabled := .UnitTypeExternalWiki.UnitGlobalDisabled }}
2023-06-14 16:42:52 -04:00
{{ $isBothWikiGlobalDisabled := and $isWikiGlobalDisabled $isExternalWikiGlobalDisabled }}
2017-03-15 18:39:38 -04:00
< div class = "inline field" >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.wiki" }} </ label >
< div class = "ui checkbox {{ if $isBothWikiGlobalDisabled }} disabled {{ end }} " {{ if $isBothWikiGlobalDisabled }} data-tooltip-content = " {{ ctx .Locale.Tr "repo.unit_disabled" }} " {{ end }} >
2017-04-02 22:19:51 -04:00
< input class = "enable-system" name = "enable_wiki" type = "checkbox" data-target = "#wiki_box" {{ if $isWikiEnabled }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.wiki_desc" }} </ label >
2017-03-15 18:39:38 -04:00
< / div >
< / div >
2023-06-14 14:17:58 -04:00
< div class = "field {{ if not $isWikiEnabled }} disabled {{ end }} " id = "wiki_box" >
2017-03-15 18:39:38 -04:00
< div class = "field" >
2023-09-25 04:56:50 -04:00
< div class = "ui radio checkbox {{ if $isWikiGlobalDisabled }} disabled {{ end }} " {{ if $isWikiGlobalDisabled }} data-tooltip-content = " {{ ctx .Locale.Tr "repo.unit_disabled" }} " {{ end }} >
2023-08-25 22:44:00 -04:00
< input class = "enable-system-radio" name = "enable_external_wiki" type = "radio" value = "false" data-target = "#external_wiki_box" {{ if not ( .Repository.UnitEnabled $.Context $.UnitTypeExternalWiki ) }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.use_internal_wiki" }} </ label >
2015-12-07 17:30:52 -05:00
< / div >
2017-03-15 18:39:38 -04:00
< / div >
2023-12-20 15:44:55 -05:00
{{ if ( not .Repository.IsPrivate ) }}
< div class = "field {{ if ( .Repository.UnitEnabled $.Context $.UnitTypeExternalWiki ) }} disabled {{ end }} " >
< div class = "field" >
< div class = "ui checkbox" >
< input name = "globally_writeable_wiki" type = "checkbox" {{ if .Permission.IsGloballyWriteable $.UnitTypeWiki }} checked {{ end }} >
< label > {{ ctx .Locale.Tr "repo.settings.wiki_globally_editable" }} </ label >
< / div >
< / div >
< / div >
{{ end }}
2017-03-15 18:39:38 -04:00
< div class = "field" >
2023-09-25 04:56:50 -04:00
< div class = "ui radio checkbox {{ if $isExternalWikiGlobalDisabled }} disabled {{ end }} " {{ if $isExternalWikiGlobalDisabled }} data-tooltip-content = " {{ ctx .Locale.Tr "repo.unit_disabled" }} " {{ end }} >
2023-08-25 22:44:00 -04:00
< input class = "enable-system-radio" name = "enable_external_wiki" type = "radio" value = "true" data-target = "#external_wiki_box" {{ if .Repository.UnitEnabled $.Context $.UnitTypeExternalWiki }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.use_external_wiki" }} </ label >
2015-12-11 04:55:08 -05:00
< / div >
2017-03-15 18:39:38 -04:00
< / div >
2023-05-30 18:28:25 -04:00
< div class = "field gt-pl-4 {{ if not ( .Repository.UnitEnabled $.Context $.UnitTypeExternalWiki ) }} disabled {{ end }} " id = "external_wiki_box" >
2023-09-25 04:56:50 -04:00
< label for = "external_wiki_url" > {{ ctx .Locale.Tr "repo.settings.external_wiki_url" }} </ label >
2022-12-09 21:46:31 -05:00
< input id = "external_wiki_url" name = "external_wiki_url" type = "url" value = " {{ ( .Repository.MustGetUnit $.Context $.UnitTypeExternalWiki ) .ExternalWikiConfig.ExternalWikiURL }} " >
2023-09-25 04:56:50 -04:00
< p class = "help" > {{ ctx .Locale.Tr "repo.settings.external_wiki_url_desc" }} </ p >
2017-03-15 18:39:38 -04:00
< / div >
< / div >
2015-12-07 17:30:52 -05:00
2023-06-29 08:24:22 -04:00
< div class = "divider" > < / div >
2015-12-07 17:30:52 -05:00
2022-12-09 21:46:31 -05:00
{{ $isIssuesEnabled := or ( .Repository.UnitEnabled $.Context $.UnitTypeIssues ) ( .Repository.UnitEnabled $.Context $.UnitTypeExternalTracker ) }}
2023-06-14 14:17:58 -04:00
{{ $isIssuesGlobalDisabled := .UnitTypeIssues.UnitGlobalDisabled }}
{{ $isExternalTrackerGlobalDisabled := .UnitTypeExternalTracker.UnitGlobalDisabled }}
{{ $isIssuesAndExternalGlobalDisabled := and $isIssuesGlobalDisabled $isExternalTrackerGlobalDisabled }}
2017-03-15 18:39:38 -04:00
< div class = "inline field" >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.issues" }} </ label >
< div class = "ui checkbox {{ if $isIssuesAndExternalGlobalDisabled }} disabled {{ end }} " {{ if $isIssuesAndExternalGlobalDisabled }} data-tooltip-content = " {{ ctx .Locale.Tr "repo.unit_disabled" }} " {{ end }} >
2017-04-02 22:19:51 -04:00
< input class = "enable-system" name = "enable_issues" type = "checkbox" data-target = "#issue_box" {{ if $isIssuesEnabled }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.issues_desc" }} </ label >
2017-03-15 18:39:38 -04:00
< / div >
< / div >
2017-04-02 22:19:51 -04:00
< div class = "field {{ if not $isIssuesEnabled }} disabled {{ end }} " id = "issue_box" >
2017-03-15 18:39:38 -04:00
< div class = "field" >
2023-09-25 04:56:50 -04:00
< div class = "ui radio checkbox {{ if $isIssuesGlobalDisabled }} disabled {{ end }} " {{ if $isIssuesGlobalDisabled }} data-tooltip-content = " {{ ctx .Locale.Tr "repo.unit_disabled" }} " {{ end }} >
2023-08-25 22:44:00 -04:00
< input class = "enable-system-radio" name = "enable_external_tracker" type = "radio" value = "false" data-context = "#internal_issue_box" data-target = "#external_issue_box" {{ if not ( .Repository.UnitEnabled $.Context $.UnitTypeExternalTracker ) }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.use_internal_issue_tracker" }} </ label >
2017-03-15 18:39:38 -04:00
< / div >
< / div >
2023-05-30 18:28:25 -04:00
< div class = "field gt-pl-4 {{ if ( .Repository.UnitEnabled $.Context $.UnitTypeExternalTracker ) }} disabled {{ end }} " id = "internal_issue_box" >
2018-04-09 11:15:32 -04:00
{{ if .Repository.CanEnableTimetracker }}
< div class = "field" >
< div class = "ui checkbox" >
2022-12-09 21:46:31 -05:00
< input name = "enable_timetracker" class = "enable-system" data-target = "#only_contributors" type = "checkbox" {{ if .Repository.IsTimetrackerEnabled $.Context }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.enable_timetracker" }} </ label >
2018-04-09 11:15:32 -04:00
< / div >
2017-09-12 02:48:13 -04:00
< / div >
2022-12-09 21:46:31 -05:00
< div class = "field {{ if not ( .Repository.IsTimetrackerEnabled $.Context ) }} disabled {{ end }} " id = "only_contributors" >
2018-04-09 11:15:32 -04:00
< div class = "ui checkbox" >
2022-12-09 21:46:31 -05:00
< input name = "allow_only_contributors_to_track_time" type = "checkbox" {{ if .Repository.AllowOnlyContributorsToTrackTime $.Context }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.allow_only_contributors_to_track_time" }} </ label >
2018-04-09 11:15:32 -04:00
< / div >
2017-09-12 02:48:13 -04:00
< / div >
2018-04-09 11:15:32 -04:00
{{ end }}
2021-03-15 21:00:52 -04:00
< div class = "field" >
< div class = "ui checkbox" >
2022-12-09 21:46:31 -05:00
< input name = "enable_issue_dependencies" type = "checkbox" {{ if ( .Repository.IsDependenciesEnabled $.Context ) }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.issues.dependency.setting" }} </ label >
2018-07-17 17:23:58 -04:00
< / div >
2021-03-15 21:00:52 -04:00
< / div >
< div class = "ui checkbox" >
2022-08-31 11:58:54 -04:00
< input name = "enable_close_issues_via_commit_in_any_branch" type = "checkbox" {{ if .Repository.CloseIssuesViaCommitInAnyBranch }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.admin_enable_close_issues_via_commit_in_any_branch" }} </ label >
2021-03-15 21:00:52 -04:00
< / div >
2017-09-12 02:48:13 -04:00
< / div >
2017-03-15 18:39:38 -04:00
< div class = "field" >
2023-09-25 04:56:50 -04:00
< div class = "ui radio checkbox {{ if $isExternalTrackerGlobalDisabled }} disabled {{ end }} " {{ if $isExternalTrackerGlobalDisabled }} data-tooltip-content = " {{ ctx .Locale.Tr "repo.unit_disabled" }} " {{ end }} >
2023-08-25 22:44:00 -04:00
< input class = "enable-system-radio" name = "enable_external_tracker" type = "radio" value = "true" data-context = "#internal_issue_box" data-target = "#external_issue_box" {{ if .Repository.UnitEnabled $.Context $.UnitTypeExternalTracker }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.use_external_issue_tracker" }} </ label >
2017-03-15 18:39:38 -04:00
< / div >
< / div >
2023-05-30 18:28:25 -04:00
< div class = "field gt-pl-4 {{ if not ( .Repository.UnitEnabled $.Context $.UnitTypeExternalTracker ) }} disabled {{ end }} " id = "external_issue_box" >
2017-03-15 18:39:38 -04:00
< div class = "field" >
2023-09-25 04:56:50 -04:00
< label for = "external_tracker_url" > {{ ctx .Locale.Tr "repo.settings.external_tracker_url" }} </ label >
2022-12-09 21:46:31 -05:00
< input id = "external_tracker_url" name = "external_tracker_url" type = "url" value = " {{ ( .Repository.MustGetUnit $.Context $.UnitTypeExternalTracker ) .ExternalTrackerConfig.ExternalTrackerURL }} " >
2023-09-25 04:56:50 -04:00
< p class = "help" > {{ ctx .Locale.Tr "repo.settings.external_tracker_url_desc" }} </ p >
2015-12-07 17:30:52 -05:00
< / div >
2017-03-15 18:39:38 -04:00
< div class = "field" >
2023-09-25 04:56:50 -04:00
< label for = "tracker_url_format" > {{ ctx .Locale.Tr "repo.settings.tracker_url_format" }} </ label >
2023-06-14 14:17:58 -04:00
< input id = "tracker_url_format" name = "tracker_url_format" type = "url" value = " {{ ( .Repository.MustGetUnit $.Context $.UnitTypeExternalTracker ) .ExternalTrackerConfig.ExternalTrackerFormat }} " placeholder = "https://github.com/{user}/{repo}/issues/{index}" >
2023-09-25 04:56:50 -04:00
< p class = "help" > {{ ctx .Locale.Tr "repo.settings.tracker_url_format_desc" | Str2html }} </ p >
2017-03-15 18:39:38 -04:00
< / div >
< div class = "inline fields" >
2023-09-25 04:56:50 -04:00
< label for = "issue_style" > {{ ctx .Locale.Tr "repo.settings.tracker_issue_style" }} </ label >
2016-04-22 18:28:08 -04:00
< div class = "field" >
< div class = "ui radio checkbox" >
2022-12-09 21:46:31 -05:00
{{ $externalTracker := ( .Repository.MustGetUnit $.Context $.UnitTypeExternalTracker ) }}
2017-03-15 18:39:38 -04:00
{{ $externalTrackerStyle := $externalTracker .ExternalTrackerConfig.ExternalTrackerStyle }}
2022-06-10 01:39:53 -04:00
< input class = "js-tracker-issue-style" name = "tracker_issue_style" type = "radio" value = "numeric" {{ if eq $externalTrackerStyle "numeric" }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.tracker_issue_style.numeric" }} < span class = "ui light grey text" > #1234</ span ></ label >
2016-04-22 18:28:08 -04:00
< / div >
< / div >
< div class = "field" >
< div class = "ui radio checkbox" >
2022-06-10 01:39:53 -04:00
< input class = "js-tracker-issue-style" name = "tracker_issue_style" type = "radio" value = "alphanumeric" {{ if eq $externalTrackerStyle "alphanumeric" }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.tracker_issue_style.alphanumeric" }} < span class = "ui light grey text" > ABC-123 , DEFG-234</ span ></ label >
2016-04-22 18:28:08 -04:00
< / div >
< / div >
2022-06-10 01:39:53 -04:00
< div class = "field" >
< div class = "ui radio checkbox" >
< input class = "js-tracker-issue-style" name = "tracker_issue_style" type = "radio" value = "regexp" {{ if eq $externalTrackerStyle "regexp" }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.tracker_issue_style.regexp" }} < span class = "ui light grey text" > (ISSUE-\d+) , ISSUE-(\d+)</ span ></ label >
2022-06-10 01:39:53 -04:00
< / div >
< / div >
< / div >
< div class = "field {{ if ne $externalTrackerStyle "regexp" }} disabled {{ end }} " id = "tracker-issue-style-regex-box" >
2023-09-25 04:56:50 -04:00
< label for = "external_tracker_regexp_pattern" > {{ ctx .Locale.Tr "repo.settings.tracker_issue_style.regexp_pattern" }} </ label >
2022-12-09 21:46:31 -05:00
< input id = "external_tracker_regexp_pattern" name = "external_tracker_regexp_pattern" value = " {{ ( .Repository.MustGetUnit $.Context $.UnitTypeExternalTracker ) .ExternalTrackerConfig.ExternalTrackerRegexpPattern }} " >
2023-09-25 04:56:50 -04:00
< p class = "help" > {{ ctx .Locale.Tr "repo.settings.tracker_issue_style.regexp_pattern_desc" | Str2html }} </ p >
2016-04-22 18:28:08 -04:00
< / div >
2016-02-14 15:12:00 -05:00
< / div >
2017-03-15 18:39:38 -04:00
< / div >
2016-02-14 15:12:00 -05:00
2023-06-29 08:24:22 -04:00
< div class = "divider" > < / div >
2020-08-16 23:07:38 -04:00
2022-12-09 21:46:31 -05:00
{{ $isProjectsEnabled := .Repository.UnitEnabled $.Context $.UnitTypeProjects }}
2023-06-14 14:17:58 -04:00
{{ $isProjectsGlobalDisabled := .UnitTypeProjects.UnitGlobalDisabled }}
2020-08-16 23:07:38 -04:00
< div class = "inline field" >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.project_board" }} </ label >
< div class = "ui checkbox {{ if $isProjectsGlobalDisabled }} disabled {{ end }} " {{ if $isProjectsGlobalDisabled }} data-tooltip-content = " {{ ctx .Locale.Tr "repo.unit_disabled" }} " {{ end }} >
2020-08-16 23:07:38 -04:00
< input class = "enable-system" name = "enable_projects" type = "checkbox" {{ if $isProjectsEnabled }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.projects_desc" }} </ label >
2020-08-16 23:07:38 -04:00
< / div >
< / div >
2023-01-31 20:31:19 -05:00
{{ $isReleasesEnabled := .Repository.UnitEnabled $.Context $.UnitTypeReleases }}
2023-06-14 14:17:58 -04:00
{{ $isReleasesGlobalDisabled := .UnitTypeReleases.UnitGlobalDisabled }}
2023-01-31 20:31:19 -05:00
< div class = "inline field" >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.releases" }} </ label >
< div class = "ui checkbox {{ if $isReleasesGlobalDisabled }} disabled {{ end }} " {{ if $isReleasesGlobalDisabled }} data-tooltip-content = " {{ ctx .Locale.Tr "repo.unit_disabled" }} " {{ end }} >
2023-01-31 20:31:19 -05:00
< input class = "enable-system" name = "enable_releases" type = "checkbox" {{ if $isReleasesEnabled }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.releases_desc" }} </ label >
2023-01-31 20:31:19 -05:00
< / div >
< / div >
2022-12-09 21:46:31 -05:00
{{ $isPackagesEnabled := .Repository.UnitEnabled $.Context $.UnitTypePackages }}
2023-06-14 14:17:58 -04:00
{{ $isPackagesGlobalDisabled := .UnitTypePackages.UnitGlobalDisabled }}
2022-05-08 11:51:50 -04:00
< div class = "inline field" >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.packages" }} </ label >
< div class = "ui checkbox {{ if $isPackagesGlobalDisabled }} disabled {{ end }} " {{ if $isPackagesGlobalDisabled }} data-tooltip-content = " {{ ctx .Locale.Tr "repo.unit_disabled" }} " {{ end }} >
2022-05-08 11:51:50 -04:00
< input class = "enable-system" name = "enable_packages" type = "checkbox" {{ if $isPackagesEnabled }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.packages_desc" }} </ label >
2022-05-08 11:51:50 -04:00
< / div >
< / div >
Implement actions (#21937)
Close #13539.
Co-authored by: @lunny @appleboy @fuxiaohei and others.
Related projects:
- https://gitea.com/gitea/actions-proto-def
- https://gitea.com/gitea/actions-proto-go
- https://gitea.com/gitea/act
- https://gitea.com/gitea/act_runner
### Summary
The target of this PR is to bring a basic implementation of "Actions",
an internal CI/CD system of Gitea. That means even though it has been
merged, the state of the feature is **EXPERIMENTAL**, and please note
that:
- It is disabled by default;
- It shouldn't be used in a production environment currently;
- It shouldn't be used in a public Gitea instance currently;
- Breaking changes may be made before it's stable.
**Please comment on #13539 if you have any different product design
ideas**, all decisions reached there will be adopted here. But in this
PR, we don't talk about **naming, feature-creep or alternatives**.
### ⚠️ Breaking
`gitea-actions` will become a reserved user name. If a user with the
name already exists in the database, it is recommended to rename it.
### Some important reviews
- What is `DEFAULT_ACTIONS_URL` in `app.ini` for?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1055954954
- Why the api for runners is not under the normal `/api/v1` prefix?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1061173592
- Why DBFS?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1061301178
- Why ignore events triggered by `gitea-actions` bot?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1063254103
- Why there's no permission control for actions?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1090229868
### What it looks like
<details>
#### Manage runners
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205870657-c72f590e-2e08-4cd4-be7f-2e0abb299bbf.png">
#### List runs
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205872794-50fde990-2b45-48c1-a178-908e4ec5b627.png">
#### View logs
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205872501-9b7b9000-9542-4991-8f55-18ccdada77c3.png">
</details>
### How to try it
<details>
#### 1. Start Gitea
Clone this branch and [install from
source](https://docs.gitea.io/en-us/install-from-source).
Add additional configurations in `app.ini` to enable Actions:
```ini
[actions]
ENABLED = true
```
Start it.
If all is well, you'll see the management page of runners:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205877365-8e30a780-9b10-4154-b3e8-ee6c3cb35a59.png">
#### 2. Start runner
Clone the [act_runner](https://gitea.com/gitea/act_runner), and follow
the
[README](https://gitea.com/gitea/act_runner/src/branch/main/README.md)
to start it.
If all is well, you'll see a new runner has been added:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205878000-216f5937-e696-470d-b66c-8473987d91c3.png">
#### 3. Enable actions for a repo
Create a new repo or open an existing one, check the `Actions` checkbox
in settings and submit.
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205879705-53e09208-73c0-4b3e-a123-2dcf9aba4b9c.png">
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205879383-23f3d08f-1a85-41dd-a8b3-54e2ee6453e8.png">
If all is well, you'll see a new tab "Actions":
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205881648-a8072d8c-5803-4d76-b8a8-9b2fb49516c1.png">
#### 4. Upload workflow files
Upload some workflow files to `.gitea/workflows/xxx.yaml`, you can
follow the [quickstart](https://docs.github.com/en/actions/quickstart)
of GitHub Actions. Yes, Gitea Actions is compatible with GitHub Actions
in most cases, you can use the same demo:
```yaml
name: GitHub Actions Demo
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on: [push]
jobs:
Explore-GitHub-Actions:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v3
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- name: List files in the repository
run: |
ls ${{ github.workspace }}
- run: echo "🍏 This job's status is ${{ job.status }}."
```
If all is well, you'll see a new run in `Actions` tab:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205884473-79a874bc-171b-4aaf-acd5-0241a45c3b53.png">
#### 5. Check the logs of jobs
Click a run and you'll see the logs:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205884800-994b0374-67f7-48ff-be9a-4c53f3141547.png">
#### 6. Go on
You can try more examples in [the
documents](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions)
of GitHub Actions, then you might find a lot of bugs.
Come on, PRs are welcome.
</details>
See also: [Feature Preview: Gitea
Actions](https://blog.gitea.io/2022/12/feature-preview-gitea-actions/)
---------
Co-authored-by: a1012112796 <1012112796@qq.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: ChristopherHX <christopher.homberger@web.de>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2023-01-30 20:45:19 -05:00
{{ if .EnableActions }}
{{ $isActionsEnabled := .Repository.UnitEnabled $.Context $.UnitTypeActions }}
2023-06-14 14:17:58 -04:00
{{ $isActionsGlobalDisabled := .UnitTypeActions.UnitGlobalDisabled }}
Implement actions (#21937)
Close #13539.
Co-authored by: @lunny @appleboy @fuxiaohei and others.
Related projects:
- https://gitea.com/gitea/actions-proto-def
- https://gitea.com/gitea/actions-proto-go
- https://gitea.com/gitea/act
- https://gitea.com/gitea/act_runner
### Summary
The target of this PR is to bring a basic implementation of "Actions",
an internal CI/CD system of Gitea. That means even though it has been
merged, the state of the feature is **EXPERIMENTAL**, and please note
that:
- It is disabled by default;
- It shouldn't be used in a production environment currently;
- It shouldn't be used in a public Gitea instance currently;
- Breaking changes may be made before it's stable.
**Please comment on #13539 if you have any different product design
ideas**, all decisions reached there will be adopted here. But in this
PR, we don't talk about **naming, feature-creep or alternatives**.
### ⚠️ Breaking
`gitea-actions` will become a reserved user name. If a user with the
name already exists in the database, it is recommended to rename it.
### Some important reviews
- What is `DEFAULT_ACTIONS_URL` in `app.ini` for?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1055954954
- Why the api for runners is not under the normal `/api/v1` prefix?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1061173592
- Why DBFS?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1061301178
- Why ignore events triggered by `gitea-actions` bot?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1063254103
- Why there's no permission control for actions?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1090229868
### What it looks like
<details>
#### Manage runners
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205870657-c72f590e-2e08-4cd4-be7f-2e0abb299bbf.png">
#### List runs
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205872794-50fde990-2b45-48c1-a178-908e4ec5b627.png">
#### View logs
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205872501-9b7b9000-9542-4991-8f55-18ccdada77c3.png">
</details>
### How to try it
<details>
#### 1. Start Gitea
Clone this branch and [install from
source](https://docs.gitea.io/en-us/install-from-source).
Add additional configurations in `app.ini` to enable Actions:
```ini
[actions]
ENABLED = true
```
Start it.
If all is well, you'll see the management page of runners:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205877365-8e30a780-9b10-4154-b3e8-ee6c3cb35a59.png">
#### 2. Start runner
Clone the [act_runner](https://gitea.com/gitea/act_runner), and follow
the
[README](https://gitea.com/gitea/act_runner/src/branch/main/README.md)
to start it.
If all is well, you'll see a new runner has been added:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205878000-216f5937-e696-470d-b66c-8473987d91c3.png">
#### 3. Enable actions for a repo
Create a new repo or open an existing one, check the `Actions` checkbox
in settings and submit.
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205879705-53e09208-73c0-4b3e-a123-2dcf9aba4b9c.png">
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205879383-23f3d08f-1a85-41dd-a8b3-54e2ee6453e8.png">
If all is well, you'll see a new tab "Actions":
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205881648-a8072d8c-5803-4d76-b8a8-9b2fb49516c1.png">
#### 4. Upload workflow files
Upload some workflow files to `.gitea/workflows/xxx.yaml`, you can
follow the [quickstart](https://docs.github.com/en/actions/quickstart)
of GitHub Actions. Yes, Gitea Actions is compatible with GitHub Actions
in most cases, you can use the same demo:
```yaml
name: GitHub Actions Demo
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on: [push]
jobs:
Explore-GitHub-Actions:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v3
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- name: List files in the repository
run: |
ls ${{ github.workspace }}
- run: echo "🍏 This job's status is ${{ job.status }}."
```
If all is well, you'll see a new run in `Actions` tab:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205884473-79a874bc-171b-4aaf-acd5-0241a45c3b53.png">
#### 5. Check the logs of jobs
Click a run and you'll see the logs:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205884800-994b0374-67f7-48ff-be9a-4c53f3141547.png">
#### 6. Go on
You can try more examples in [the
documents](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions)
of GitHub Actions, then you might find a lot of bugs.
Come on, PRs are welcome.
</details>
See also: [Feature Preview: Gitea
Actions](https://blog.gitea.io/2022/12/feature-preview-gitea-actions/)
---------
Co-authored-by: a1012112796 <1012112796@qq.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: ChristopherHX <christopher.homberger@web.de>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2023-01-30 20:45:19 -05:00
< div class = "inline field" >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "actions.actions" }} </ label >
< div class = "ui checkbox {{ if $isActionsGlobalDisabled }} disabled {{ end }} " {{ if $isActionsGlobalDisabled }} data-tooltip-content = " {{ ctx .Locale.Tr "repo.unit_disabled" }} " {{ end }} >
Implement actions (#21937)
Close #13539.
Co-authored by: @lunny @appleboy @fuxiaohei and others.
Related projects:
- https://gitea.com/gitea/actions-proto-def
- https://gitea.com/gitea/actions-proto-go
- https://gitea.com/gitea/act
- https://gitea.com/gitea/act_runner
### Summary
The target of this PR is to bring a basic implementation of "Actions",
an internal CI/CD system of Gitea. That means even though it has been
merged, the state of the feature is **EXPERIMENTAL**, and please note
that:
- It is disabled by default;
- It shouldn't be used in a production environment currently;
- It shouldn't be used in a public Gitea instance currently;
- Breaking changes may be made before it's stable.
**Please comment on #13539 if you have any different product design
ideas**, all decisions reached there will be adopted here. But in this
PR, we don't talk about **naming, feature-creep or alternatives**.
### ⚠️ Breaking
`gitea-actions` will become a reserved user name. If a user with the
name already exists in the database, it is recommended to rename it.
### Some important reviews
- What is `DEFAULT_ACTIONS_URL` in `app.ini` for?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1055954954
- Why the api for runners is not under the normal `/api/v1` prefix?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1061173592
- Why DBFS?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1061301178
- Why ignore events triggered by `gitea-actions` bot?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1063254103
- Why there's no permission control for actions?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1090229868
### What it looks like
<details>
#### Manage runners
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205870657-c72f590e-2e08-4cd4-be7f-2e0abb299bbf.png">
#### List runs
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205872794-50fde990-2b45-48c1-a178-908e4ec5b627.png">
#### View logs
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205872501-9b7b9000-9542-4991-8f55-18ccdada77c3.png">
</details>
### How to try it
<details>
#### 1. Start Gitea
Clone this branch and [install from
source](https://docs.gitea.io/en-us/install-from-source).
Add additional configurations in `app.ini` to enable Actions:
```ini
[actions]
ENABLED = true
```
Start it.
If all is well, you'll see the management page of runners:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205877365-8e30a780-9b10-4154-b3e8-ee6c3cb35a59.png">
#### 2. Start runner
Clone the [act_runner](https://gitea.com/gitea/act_runner), and follow
the
[README](https://gitea.com/gitea/act_runner/src/branch/main/README.md)
to start it.
If all is well, you'll see a new runner has been added:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205878000-216f5937-e696-470d-b66c-8473987d91c3.png">
#### 3. Enable actions for a repo
Create a new repo or open an existing one, check the `Actions` checkbox
in settings and submit.
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205879705-53e09208-73c0-4b3e-a123-2dcf9aba4b9c.png">
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205879383-23f3d08f-1a85-41dd-a8b3-54e2ee6453e8.png">
If all is well, you'll see a new tab "Actions":
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205881648-a8072d8c-5803-4d76-b8a8-9b2fb49516c1.png">
#### 4. Upload workflow files
Upload some workflow files to `.gitea/workflows/xxx.yaml`, you can
follow the [quickstart](https://docs.github.com/en/actions/quickstart)
of GitHub Actions. Yes, Gitea Actions is compatible with GitHub Actions
in most cases, you can use the same demo:
```yaml
name: GitHub Actions Demo
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on: [push]
jobs:
Explore-GitHub-Actions:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v3
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- name: List files in the repository
run: |
ls ${{ github.workspace }}
- run: echo "🍏 This job's status is ${{ job.status }}."
```
If all is well, you'll see a new run in `Actions` tab:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205884473-79a874bc-171b-4aaf-acd5-0241a45c3b53.png">
#### 5. Check the logs of jobs
Click a run and you'll see the logs:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205884800-994b0374-67f7-48ff-be9a-4c53f3141547.png">
#### 6. Go on
You can try more examples in [the
documents](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions)
of GitHub Actions, then you might find a lot of bugs.
Come on, PRs are welcome.
</details>
See also: [Feature Preview: Gitea
Actions](https://blog.gitea.io/2022/12/feature-preview-gitea-actions/)
---------
Co-authored-by: a1012112796 <1012112796@qq.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: ChristopherHX <christopher.homberger@web.de>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2023-01-30 20:45:19 -05:00
< input class = "enable-system" name = "enable_actions" type = "checkbox" {{ if $isActionsEnabled }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.actions_desc" }} </ label >
Implement actions (#21937)
Close #13539.
Co-authored by: @lunny @appleboy @fuxiaohei and others.
Related projects:
- https://gitea.com/gitea/actions-proto-def
- https://gitea.com/gitea/actions-proto-go
- https://gitea.com/gitea/act
- https://gitea.com/gitea/act_runner
### Summary
The target of this PR is to bring a basic implementation of "Actions",
an internal CI/CD system of Gitea. That means even though it has been
merged, the state of the feature is **EXPERIMENTAL**, and please note
that:
- It is disabled by default;
- It shouldn't be used in a production environment currently;
- It shouldn't be used in a public Gitea instance currently;
- Breaking changes may be made before it's stable.
**Please comment on #13539 if you have any different product design
ideas**, all decisions reached there will be adopted here. But in this
PR, we don't talk about **naming, feature-creep or alternatives**.
### ⚠️ Breaking
`gitea-actions` will become a reserved user name. If a user with the
name already exists in the database, it is recommended to rename it.
### Some important reviews
- What is `DEFAULT_ACTIONS_URL` in `app.ini` for?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1055954954
- Why the api for runners is not under the normal `/api/v1` prefix?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1061173592
- Why DBFS?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1061301178
- Why ignore events triggered by `gitea-actions` bot?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1063254103
- Why there's no permission control for actions?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1090229868
### What it looks like
<details>
#### Manage runners
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205870657-c72f590e-2e08-4cd4-be7f-2e0abb299bbf.png">
#### List runs
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205872794-50fde990-2b45-48c1-a178-908e4ec5b627.png">
#### View logs
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205872501-9b7b9000-9542-4991-8f55-18ccdada77c3.png">
</details>
### How to try it
<details>
#### 1. Start Gitea
Clone this branch and [install from
source](https://docs.gitea.io/en-us/install-from-source).
Add additional configurations in `app.ini` to enable Actions:
```ini
[actions]
ENABLED = true
```
Start it.
If all is well, you'll see the management page of runners:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205877365-8e30a780-9b10-4154-b3e8-ee6c3cb35a59.png">
#### 2. Start runner
Clone the [act_runner](https://gitea.com/gitea/act_runner), and follow
the
[README](https://gitea.com/gitea/act_runner/src/branch/main/README.md)
to start it.
If all is well, you'll see a new runner has been added:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205878000-216f5937-e696-470d-b66c-8473987d91c3.png">
#### 3. Enable actions for a repo
Create a new repo or open an existing one, check the `Actions` checkbox
in settings and submit.
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205879705-53e09208-73c0-4b3e-a123-2dcf9aba4b9c.png">
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205879383-23f3d08f-1a85-41dd-a8b3-54e2ee6453e8.png">
If all is well, you'll see a new tab "Actions":
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205881648-a8072d8c-5803-4d76-b8a8-9b2fb49516c1.png">
#### 4. Upload workflow files
Upload some workflow files to `.gitea/workflows/xxx.yaml`, you can
follow the [quickstart](https://docs.github.com/en/actions/quickstart)
of GitHub Actions. Yes, Gitea Actions is compatible with GitHub Actions
in most cases, you can use the same demo:
```yaml
name: GitHub Actions Demo
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on: [push]
jobs:
Explore-GitHub-Actions:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v3
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- name: List files in the repository
run: |
ls ${{ github.workspace }}
- run: echo "🍏 This job's status is ${{ job.status }}."
```
If all is well, you'll see a new run in `Actions` tab:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205884473-79a874bc-171b-4aaf-acd5-0241a45c3b53.png">
#### 5. Check the logs of jobs
Click a run and you'll see the logs:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205884800-994b0374-67f7-48ff-be9a-4c53f3141547.png">
#### 6. Go on
You can try more examples in [the
documents](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions)
of GitHub Actions, then you might find a lot of bugs.
Come on, PRs are welcome.
</details>
See also: [Feature Preview: Gitea
Actions](https://blog.gitea.io/2022/12/feature-preview-gitea-actions/)
---------
Co-authored-by: a1012112796 <1012112796@qq.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: ChristopherHX <christopher.homberger@web.de>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2023-01-30 20:45:19 -05:00
< / div >
< / div >
{{ end }}
2020-10-30 12:27:01 -04:00
{{ if not .IsMirror }}
2023-06-29 08:24:22 -04:00
< div class = "divider" > < / div >
2022-12-09 21:46:31 -05:00
{{ $pullRequestEnabled := .Repository.UnitEnabled $.Context $.UnitTypePullRequests }}
2023-06-14 14:17:58 -04:00
{{ $pullRequestGlobalDisabled := .UnitTypePullRequests.UnitGlobalDisabled }}
2022-12-09 21:46:31 -05:00
{{ $prUnit := .Repository.MustGetUnit $.Context $.UnitTypePullRequests }}
2017-03-15 18:39:38 -04:00
< div class = "inline field" >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.pulls" }} </ label >
< div class = "ui checkbox {{ if $pullRequestGlobalDisabled }} disabled {{ end }} " {{ if $pullRequestGlobalDisabled }} data-tooltip-content = " {{ ctx .Locale.Tr "repo.unit_disabled" }} " {{ end }} >
2018-01-05 13:56:50 -05:00
< input class = "enable-system" name = "enable_pulls" type = "checkbox" data-target = "#pull_box" {{ if $pullRequestEnabled }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.pulls_desc" }} </ label >
2015-08-29 15:21:59 -04:00
< / div >
< / div >
2018-01-05 13:56:50 -05:00
< div class = "field {{ if not $pullRequestEnabled }} disabled {{ end }} " id = "pull_box" >
< div class = "field" >
2023-02-13 01:09:52 -05:00
< p >
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.merge_style_desc" }}
2023-02-13 01:09:52 -05:00
< / p >
2018-01-05 13:56:50 -05:00
< / div >
< div class = "field" >
< div class = "ui checkbox" >
< input name = "pulls_allow_merge" type = "checkbox" {{ if or ( not $pullRequestEnabled ) ( $prUnit .PullRequestsConfig.AllowMerge ) }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.pulls.merge_pull_request" }} </ label >
2018-01-05 13:56:50 -05:00
< / div >
< / div >
< div class = "field" >
< div class = "ui checkbox" >
< input name = "pulls_allow_rebase" type = "checkbox" {{ if or ( not $pullRequestEnabled ) ( $prUnit .PullRequestsConfig.AllowRebase ) }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.pulls.rebase_merge_pull_request" }} </ label >
2018-01-05 13:56:50 -05:00
< / div >
< / div >
2018-12-27 05:27:08 -05:00
< div class = "field" >
< div class = "ui checkbox" >
< input name = "pulls_allow_rebase_merge" type = "checkbox" {{ if or ( not $pullRequestEnabled ) ( $prUnit .PullRequestsConfig.AllowRebaseMerge ) }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.pulls.rebase_merge_commit_pull_request" }} </ label >
2018-12-27 05:27:08 -05:00
< / div >
< / div >
2018-01-05 13:56:50 -05:00
< div class = "field" >
< div class = "ui checkbox" >
< input name = "pulls_allow_squash" type = "checkbox" {{ if or ( not $pullRequestEnabled ) ( $prUnit .PullRequestsConfig.AllowSquash ) }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.pulls.squash_merge_pull_request" }} </ label >
2018-01-05 13:56:50 -05:00
< / div >
< / div >
2021-03-03 22:41:23 -05:00
< div class = "field" >
< div class = "ui checkbox" >
< input name = "pulls_allow_manual_merge" type = "checkbox" {{ if or ( not $pullRequestEnabled ) ( $prUnit .PullRequestsConfig.AllowManualMerge ) }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.pulls.merge_manually" }} </ label >
2021-07-12 19:26:25 -04:00
< / div >
< / div >
2023-02-13 01:09:52 -05:00
2021-03-27 10:55:40 -04:00
< div class = "field" >
< p >
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.default_merge_style_desc" }}
2021-03-27 10:55:40 -04:00
< / p >
2023-08-25 22:44:00 -04:00
< div class = "ui dropdown selection" >
2021-03-27 10:55:40 -04:00
< select name = "pulls_default_merge_style" >
2023-09-25 04:56:50 -04:00
< option value = "merge" {{ if or ( not $pullRequestEnabled ) ( eq $prUnit .PullRequestsConfig.DefaultMergeStyle "merge" ) }} selected {{ end }} > {{ ctx .Locale.Tr "repo.pulls.merge_pull_request" }} </ option >
< option value = "rebase" {{ if or ( not $pullRequestEnabled ) ( eq $prUnit .PullRequestsConfig.DefaultMergeStyle "rebase" ) }} selected {{ end }} > {{ ctx .Locale.Tr "repo.pulls.rebase_merge_pull_request" }} </ option >
< option value = "rebase-merge" {{ if or ( not $pullRequestEnabled ) ( eq $prUnit .PullRequestsConfig.DefaultMergeStyle "rebase-merge" ) }} selected {{ end }} > {{ ctx .Locale.Tr "repo.pulls.rebase_merge_commit_pull_request" }} </ option >
< option value = "squash" {{ if or ( not $pullRequestEnabled ) ( eq $prUnit .PullRequestsConfig.DefaultMergeStyle "squash" ) }} selected {{ end }} > {{ ctx .Locale.Tr "repo.pulls.squash_merge_pull_request" }} </ option >
2021-03-27 10:55:40 -04:00
</ select > {{ svg "octicon-triangle-down" 14 "dropdown icon" }}
< div class = "default text" >
{{ if ( eq $prUnit .PullRequestsConfig.DefaultMergeStyle "merge" ) }}
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.pulls.merge_pull_request" }}
2021-03-27 10:55:40 -04:00
{{ end }}
{{ if ( eq $prUnit .PullRequestsConfig.DefaultMergeStyle "rebase" ) }}
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.pulls.rebase_merge_pull_request" }}
2021-03-27 10:55:40 -04:00
{{ end }}
{{ if ( eq $prUnit .PullRequestsConfig.DefaultMergeStyle "rebase-merge" ) }}
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.pulls.rebase_merge_commit_pull_request" }}
2021-03-27 10:55:40 -04:00
{{ end }}
{{ if ( eq $prUnit .PullRequestsConfig.DefaultMergeStyle "squash" ) }}
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.pulls.squash_merge_pull_request" }}
2021-03-27 10:55:40 -04:00
{{ end }}
< / div >
2023-02-14 06:53:54 -05:00
< div class = "menu" >
2023-09-25 04:56:50 -04:00
< div class = "item" data-value = "merge" > {{ ctx .Locale.Tr "repo.pulls.merge_pull_request" }} </ div >
< div class = "item" data-value = "rebase" > {{ ctx .Locale.Tr "repo.pulls.rebase_merge_pull_request" }} </ div >
< div class = "item" data-value = "rebase-merge" > {{ ctx .Locale.Tr "repo.pulls.rebase_merge_commit_pull_request" }} </ div >
< div class = "item" data-value = "squash" > {{ ctx .Locale.Tr "repo.pulls.squash_merge_pull_request" }} </ div >
2021-03-27 10:55:40 -04:00
< / div >
< / div >
< / div >
2023-02-13 01:09:52 -05:00
< div class = "field" >
< div class = "ui checkbox" >
< input name = "default_allow_maintainer_edit" type = "checkbox" {{ if or ( not $pullRequestEnabled ) ( $prUnit .PullRequestsConfig.DefaultAllowMaintainerEdit ) }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.pulls.default_allow_edits_from_maintainers" }} </ label >
2023-02-13 01:09:52 -05:00
< / div >
< / div >
< div class = "field" >
< div class = "ui checkbox" >
< input name = "pulls_allow_rebase_update" type = "checkbox" {{ if or ( not $pullRequestEnabled ) ( $prUnit .PullRequestsConfig.AllowRebaseUpdate ) }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.pulls.allow_rebase_update" }} </ label >
2023-02-13 01:09:52 -05:00
< / div >
< / div >
< div class = "field" >
< div class = "ui checkbox" >
< input name = "default_delete_branch_after_merge" type = "checkbox" {{ if or ( not $pullRequestEnabled ) ( $prUnit .PullRequestsConfig.DefaultDeleteBranchAfterMerge ) }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.pulls.default_delete_branch_after_merge" }} </ label >
2023-02-13 01:09:52 -05:00
< / div >
< / div >
< div class = "field" >
< div class = "ui checkbox" >
< input name = "enable_autodetect_manual_merge" type = "checkbox" {{ if or ( not $pullRequestEnabled ) ( $prUnit .PullRequestsConfig.AutodetectManualMerge ) }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.pulls.enable_autodetect_manual_merge" }} </ label >
2023-02-13 01:09:52 -05:00
< / div >
< / div >
< div class = "field" >
< div class = "ui checkbox" >
< input name = "pulls_ignore_whitespace" type = "checkbox" {{ if and $pullRequestEnabled ( $prUnit .PullRequestsConfig.IgnoreWhitespaceConflicts ) }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.pulls.ignore_whitespace" }} </ label >
2023-02-13 01:09:52 -05:00
< / div >
< / div >
2018-01-05 13:56:50 -05:00
< / div >
2017-03-15 18:39:38 -04:00
{{ end }}
2015-12-07 17:30:52 -05:00
2023-06-29 08:24:22 -04:00
< div class = "divider" > < / div >
2017-03-15 18:39:38 -04:00
< div class = "field" >
2023-09-25 04:56:50 -04:00
< button class = "ui primary button" > {{ ctx .Locale.Tr "repo.settings.update_settings" }} </ button >
2017-03-15 18:39:38 -04:00
< / div >
< / form >
< / div >
2016-03-03 15:38:25 -05:00
2020-09-19 12:44:55 -04:00
< h4 class = "ui top attached header" >
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.signing_settings" }}
2020-09-19 12:44:55 -04:00
< / h4 >
< div class = "ui attached segment" >
< form class = "ui form" method = "post" >
{{ .CsrfTokenHtml }}
< input type = "hidden" name = "action" value = "signing" >
< div class = "field" >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.trust_model" }} </ label >< br >
2020-09-19 12:44:55 -04:00
< div class = "field" >
< div class = "ui radio checkbox" >
< input type = "radio" id = "trust_model_default" name = "trust_model" {{ if eq .Repository.TrustModel.String "default" }} checked = "checked" {{ end }} value = "default" >
2023-09-25 04:56:50 -04:00
< label for = "trust_model_default" > {{ ctx .Locale.Tr "repo.settings.trust_model.default" }} </ label >
< p class = "help" > {{ ctx .Locale.Tr "repo.settings.trust_model.default.desc" }} </ p >
2020-09-19 12:44:55 -04:00
< / div >
< / div >
< div class = "field" >
< div class = "ui radio checkbox" >
< input type = "radio" id = "trust_model_collaborator" name = "trust_model" {{ if eq .Repository.TrustModel.String "collaborator" }} checked = "checked" {{ end }} value = "collaborator" >
2023-09-25 04:56:50 -04:00
< label for = "trust_model_collaborator" > {{ ctx .Locale.Tr "repo.settings.trust_model.collaborator.long" }} </ label >
< p class = "help" > {{ ctx .Locale.Tr "repo.settings.trust_model.collaborator.desc" }} </ p >
2020-09-19 12:44:55 -04:00
< / div >
< / div >
< div class = "field" >
< div class = "ui radio checkbox" >
< input type = "radio" name = "trust_model" id = "trust_model_committer" {{ if eq .Repository.TrustModel.String "committer" }} checked = "checked" {{ end }} value = "committer" >
2023-09-25 04:56:50 -04:00
< label for = "trust_model_committer" > {{ ctx .Locale.Tr "repo.settings.trust_model.committer.long" }} </ label >
< p class = "help" > {{ ctx .Locale.Tr "repo.settings.trust_model.committer.desc" }} </ p >
2020-09-19 12:44:55 -04:00
< / div >
< / div >
< div class = "field" >
< div class = "ui radio checkbox" >
< input type = "radio" name = "trust_model" id = "trust_model_collaboratorcommitter" {{ if eq .Repository.TrustModel.String "collaboratorcommitter" }} checked = "checked" {{ end }} value = "collaboratorcommitter" >
2023-09-25 04:56:50 -04:00
< label for = "trust_model_collaboratorcommitter" > {{ ctx .Locale.Tr "repo.settings.trust_model.collaboratorcommitter.long" }} </ label >
< p class = "help" > {{ ctx .Locale.Tr "repo.settings.trust_model.collaboratorcommitter.desc" }} </ p >
2020-09-19 12:44:55 -04:00
< / div >
< / div >
< / div >
2023-06-29 08:24:22 -04:00
< div class = "divider" > < / div >
2020-09-19 12:44:55 -04:00
< div class = "field" >
2023-09-25 04:56:50 -04:00
< button class = "ui primary button" > {{ ctx .Locale.Tr "repo.settings.update_settings" }} </ button >
2020-09-19 12:44:55 -04:00
< / div >
< / form >
< / div >
2018-03-27 10:13:20 -04:00
{{ if .IsAdmin }}
< h4 class = "ui top attached header" >
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.admin_settings" }}
2018-03-27 10:13:20 -04:00
< / h4 >
< div class = "ui attached segment" >
< form class = "ui form" method = "post" >
{{ .CsrfTokenHtml }}
< input type = "hidden" name = "action" value = "admin" >
< div class = "field" >
< div class = "ui checkbox" >
< input name = "enable_health_check" type = "checkbox" {{ if .Repository.IsFsckEnabled }} checked {{ end }} >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.admin_enable_health_check" }} </ label >
2018-03-27 10:13:20 -04:00
< / div >
< / div >
< div class = "field" >
2023-09-25 04:56:50 -04:00
< button class = "ui primary button" > {{ ctx .Locale.Tr "repo.settings.update_settings" }} </ button >
2018-03-27 10:13:20 -04:00
< / div >
< / form >
2021-12-16 10:55:12 -05:00
2023-06-29 08:24:22 -04:00
< div class = "divider" > < / div >
2021-12-16 10:55:12 -05:00
< form class = "ui form" method = "post" >
{{ .CsrfTokenHtml }}
< input type = "hidden" name = "action" value = "admin_index" >
{{ if .CodeIndexerEnabled }}
2023-09-25 04:56:50 -04:00
< h4 class = "ui header" > {{ ctx .Locale.Tr "repo.settings.admin_code_indexer" }} </ h4 >
2021-12-16 10:55:12 -05:00
< div class = "inline fields" >
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.admin_indexer_commit_sha" }} </ label >
2021-12-16 10:55:12 -05:00
< span class = "field" >
{{ if .CodeIndexerStatus }}
< a rel = "nofollow" class = "ui sha label" href = " {{ .RepoLink }} /commit/ {{ .CodeIndexerStatus.CommitSha }} " >
< span class = "shortsha" > {{ ShortSha .CodeIndexerStatus.CommitSha }} </ span >
< / a >
{{ else }}
2023-09-25 04:56:50 -04:00
< span > {{ ctx .Locale.Tr "repo.settings.admin_indexer_unindexed" }} </ span >
2021-12-16 10:55:12 -05:00
{{ end }}
< / span >
< div class = "field" >
2023-09-25 04:56:50 -04:00
< button class = "ui primary button" name = "request_reindex_type" value = "code" > {{ ctx .Locale.Tr "repo.settings.reindex_button" }} </ button >
2021-12-16 10:55:12 -05:00
< / div >
< / div >
{{ end }}
2023-09-25 04:56:50 -04:00
< h4 class = "ui header" > {{ ctx .Locale.Tr "repo.settings.admin_stats_indexer" }} </ h4 >
2021-12-16 10:55:12 -05:00
< div class = "inline fields" >
2023-08-05 07:04:14 -04:00
{{ if and .StatsIndexerStatus .StatsIndexerStatus.CommitSha }}
2023-09-25 04:56:50 -04:00
< label > {{ ctx .Locale.Tr "repo.settings.admin_indexer_commit_sha" }} </ label >
2023-08-05 07:04:14 -04:00
{{ end }}
2021-12-16 10:55:12 -05:00
< span class = "field" >
2023-08-05 07:04:14 -04:00
{{ if and .StatsIndexerStatus .StatsIndexerStatus.CommitSha }}
2021-12-16 10:55:12 -05:00
< a rel = "nofollow" class = "ui sha label" href = " {{ .RepoLink }} /commit/ {{ .StatsIndexerStatus.CommitSha }} " >
< span class = "shortsha" > {{ ShortSha .StatsIndexerStatus.CommitSha }} </ span >
< / a >
{{ else }}
2023-09-25 04:56:50 -04:00
< span > {{ ctx .Locale.Tr "repo.settings.admin_indexer_unindexed" }} </ span >
2021-12-16 10:55:12 -05:00
{{ end }}
< / span >
< div class = "field" >
2023-09-25 04:56:50 -04:00
< button class = "ui primary button" name = "request_reindex_type" value = "stats" > {{ ctx .Locale.Tr "repo.settings.reindex_button" }} </ button >
2021-12-16 10:55:12 -05:00
< / div >
< / div >
< / form >
2018-03-27 10:13:20 -04:00
< / div >
{{ end }}
2018-11-28 06:26:14 -05:00
{{ if .Permission.IsOwner }}
2020-10-04 16:54:22 -04:00
< h4 class = "ui top attached error header" >
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.danger_zone" }}
2017-03-15 18:39:38 -04:00
< / h4 >
2023-07-31 18:13:42 -04:00
< div class = "ui attached error danger segment" >
< div class = "flex-list" >
{{ if .Repository.IsMirror }}
< div class = "flex-item" >
< div class = "flex-item-main" >
2023-09-25 04:56:50 -04:00
< div class = "flex-item-title" > {{ ctx .Locale.Tr "repo.settings.convert" }} </ div >
< div class = "flex-item-body" > {{ ctx .Locale.Tr "repo.settings.convert_desc" }} </ div >
2023-07-31 18:13:42 -04:00
< / div >
< div class = "flex-item-trailing" >
2023-09-25 04:56:50 -04:00
< button class = "ui basic red show-modal button" data-modal = "#convert-mirror-repo-modal" > {{ ctx .Locale.Tr "repo.settings.convert" }} </ button >
2023-07-31 18:13:42 -04:00
< / div >
2020-07-02 10:09:09 -04:00
< / div >
2023-07-31 18:13:42 -04:00
{{ end }}
{{ if and .Repository.IsFork .Repository.Owner.CanCreateRepo }}
< div class = "flex-item" >
< div class = "flex-item-main" >
2023-09-25 04:56:50 -04:00
< div class = "flex-item-title" > {{ ctx .Locale.Tr "repo.settings.convert_fork" }} </ div >
< div class = "flex-item-body" > {{ ctx .Locale.Tr "repo.settings.convert_fork_desc" }} </ div >
2023-07-31 18:13:42 -04:00
< / div >
< div class = "flex-item-trailing" >
2023-09-25 04:56:50 -04:00
< button class = "ui basic red show-modal button" data-modal = "#convert-fork-repo-modal" > {{ ctx .Locale.Tr "repo.settings.convert_fork" }} </ button >
2023-07-31 18:13:42 -04:00
< / div >
2020-07-02 10:09:09 -04:00
< / div >
2023-07-31 18:13:42 -04:00
{{ end }}
< div class = "flex-item" >
< div class = "flex-item-main" >
2023-09-25 04:56:50 -04:00
< div class = "flex-item-title" > {{ ctx .Locale.Tr "repo.settings.transfer" }} </ div >
2023-07-31 18:13:42 -04:00
< div class = "flex-item-body" >
{{ if .RepoTransfer }}
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.transfer_started" .RepoTransfer.Recipient.DisplayName }}
2023-07-31 18:13:42 -04:00
{{ else }}
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.transfer_desc" }}
2023-07-31 18:13:42 -04:00
{{ end }}
< / div >
2020-07-02 10:09:09 -04:00
< / div >
2023-07-31 18:13:42 -04:00
< div class = "flex-item-trailing" >
{{ if .RepoTransfer }}
< form class = "ui form" action = " {{ .Link }} " method = "post" >
{{ .CsrfTokenHtml }}
< input type = "hidden" name = "action" value = "cancel_transfer" >
2023-09-25 04:56:50 -04:00
< button class = "ui red button" > {{ ctx .Locale.Tr "repo.settings.transfer_abort" }} </ button >
2023-07-31 18:13:42 -04:00
< / form >
{{ else }}
2023-09-25 04:56:50 -04:00
< button class = "ui basic red show-modal button" data-modal = "#transfer-repo-modal" > {{ ctx .Locale.Tr "repo.settings.transfer" }} </ button >
2023-07-31 18:13:42 -04:00
{{ end }}
2020-07-02 10:09:09 -04:00
< / div >
2017-03-15 18:39:38 -04:00
< / div >
2023-07-31 18:13:42 -04:00
{{ if .Permission.CanRead $.UnitTypeWiki }}
[GITEA] Allow changing the repo Wiki branch to main
Previously, the repo wiki was hardcoded to use `master` as its branch,
this change makes it possible to use `main` (or something else, governed
by `[repository].DEFAULT_BRANCH`, a setting that already exists and
defaults to `main`).
The way it is done is that a new column is added to the `repository`
table: `wiki_branch`. The migration will make existing repositories
default to `master`, for compatibility's sake, even if they don't have a
Wiki (because it's easier to do that). Newly created repositories will
default to `[repository].DEFAULT_BRANCH` instead.
The Wiki service was updated to use the branch name stored in the
database, and fall back to the default if it is empty.
Old repositories with Wikis using the older `master` branch will have
the option to do a one-time transition to `main`, available via the
repository settings in the "Danger Zone". This option will only be
available for repositories that have the internal wiki enabled, it is
not empty, and the wiki branch is not `[repository].DEFAULT_BRANCH`.
When migrating a repository with a Wiki, Forgejo will use the same
branch name for the wiki as the source repository did. If that's not the
same as the default, the option to normalize it will be available after
the migration's done.
Additionally, the `/api/v1/{owner}/{repo}` endpoint was updated: it will
now include the wiki branch name in `GET` requests, and allow changing
the wiki branch via `PATCH`.
Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit d87c526d2a313fa45093ab49b78bb30322b33298)
2024-01-30 06:18:53 -05:00
{{ if ne $.Repository.GetWikiBranchName .DefaultWikiBranchName }}
< div class = "flex-item" >
< div class = "flex-item-main" >
< div class = "flex-item-title" > {{ ctx .Locale.Tr "repo.settings.wiki_rename_branch_main" }} </ div >
< div class = "flex-item-body" > {{ ctx .Locale.Tr "repo.settings.wiki_rename_branch_main_desc" .DefaultWikiBranchName }} </ div >
< / div >
< div class = "flex-item-trailing" >
< button class = "ui basic red show-modal button" data-modal = "#rename-wiki-branch-modal" > {{ ctx .Locale.Tr "repo.settings.wiki_rename_branch_main" }} </ button >
< / div >
< / div >
{{ end }}
2023-07-31 18:13:42 -04:00
< div class = "flex-item" >
< div class = "flex-item-main" >
2023-09-25 04:56:50 -04:00
< div class = "flex-item-title" > {{ ctx .Locale.Tr "repo.settings.wiki_delete" }} </ div >
< div class = "flex-item-body" > {{ ctx .Locale.Tr "repo.settings.wiki_delete_desc" }} </ div >
2023-07-31 18:13:42 -04:00
< / div >
< div class = "flex-item-trailing" >
2023-09-25 04:56:50 -04:00
< button class = "ui basic red show-modal button" data-modal = "#delete-wiki-modal" > {{ ctx .Locale.Tr "repo.settings.wiki_delete" }} </ button >
2023-07-31 18:13:42 -04:00
< / div >
2017-03-15 18:39:38 -04:00
< / div >
2023-07-31 18:13:42 -04:00
{{ end }}
< div class = "flex-item" >
< div class = "flex-item-main" >
2023-09-25 04:56:50 -04:00
< div class = "flex-item-title" > {{ ctx .Locale.Tr "repo.settings.delete" }} </ div >
< div class = "flex-item-body" > {{ ctx .Locale.Tr "repo.settings.delete_desc" }} </ div >
2023-07-31 18:13:42 -04:00
< / div >
< div class = "flex-item-trailing" >
2023-09-25 04:56:50 -04:00
< button class = "ui basic red show-modal button" data-modal = "#delete-repo-modal" > {{ ctx .Locale.Tr "repo.settings.delete" }} </ button >
2015-08-29 15:21:59 -04:00
< / div >
2015-12-07 17:30:52 -05:00
< / div >
2023-07-31 18:13:42 -04:00
{{ if not .Repository.IsMirror }}
2023-09-08 09:57:18 -04:00
< div class = "flex-item gt-ac" >
2023-07-31 18:13:42 -04:00
< div class = "flex-item-main" >
2019-01-23 13:58:38 -05:00
{{ if .Repository.IsArchived }}
2023-09-25 04:56:50 -04:00
< div class = "flex-item-title" > {{ ctx .Locale.Tr "repo.settings.unarchive.header" }} </ div >
< div class = "flex-item-body" > {{ ctx .Locale.Tr "repo.settings.unarchive.text" }} </ div >
2019-01-23 13:58:38 -05:00
{{ else }}
2023-09-25 04:56:50 -04:00
< div class = "flex-item-title" > {{ ctx .Locale.Tr "repo.settings.archive.header" }} </ div >
< div class = "flex-item-body" > {{ ctx .Locale.Tr "repo.settings.archive.text" }} </ div >
2019-01-23 13:58:38 -05:00
{{ end }}
2023-07-31 18:13:42 -04:00
< / div >
< div class = "flex-item-trailing" >
< button class = "ui basic red show-modal button" data-modal = "#archive-repo-modal" >
{{ if .Repository.IsArchived }}
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.unarchive.button" }}
2023-07-31 18:13:42 -04:00
{{ else }}
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.archive.button" }}
2023-07-31 18:13:42 -04:00
{{ end }}
< / button >
< / div >
2019-01-23 13:58:38 -05:00
< / div >
2023-07-31 18:13:42 -04:00
{{ end }}
< / div >
2015-12-07 17:30:52 -05:00
< / div >
2017-03-15 18:39:38 -04:00
{{ end }}
2015-12-07 17:30:52 -05:00
< / div >
2023-04-23 06:21:21 -04:00
{{ template "repo/settings/layout_footer" . }}
2015-08-29 15:21:59 -04:00
2018-11-28 06:26:14 -05:00
{{ if .Permission.IsOwner }}
2016-03-05 20:45:23 -05:00
{{ if .Repository.IsMirror }}
2020-07-02 10:09:09 -04:00
< div class = "ui small modal" id = "convert-mirror-repo-modal" >
< div class = "header" >
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.convert" }}
2016-02-14 15:12:00 -05:00
< / div >
2020-07-02 10:09:09 -04:00
< div class = "content" >
2023-05-03 14:32:10 -04:00
< div class = "ui warning message" >
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.convert_notices_1" }}
2016-03-05 20:45:23 -05:00
< / div >
2020-07-02 10:09:09 -04:00
< form class = "ui form" action = " {{ .Link }} " method = "post" >
{{ .CsrfTokenHtml }}
< input type = "hidden" name = "action" value = "convert" >
< div class = "field" >
< label >
2024-01-31 05:20:57 -05:00
{{ ctx .Locale.Tr "repo.settings.enter_repo_name" }}
2023-11-23 14:24:52 -05:00
< span class = "text red" > {{ .Repository.FullName }} </ span >
2020-07-02 10:09:09 -04:00
< / label >
< / div >
< div class = "required field" >
2023-09-25 04:56:50 -04:00
< label for = "repo_name" > {{ ctx .Locale.Tr "repo.repo_name" }} </ label >
2023-05-26 05:42:54 -04:00
< input id = "repo_name" name = "repo_name" required maxlength = "100" >
2020-07-02 10:09:09 -04:00
< / div >
2016-02-14 15:12:00 -05:00
2020-07-02 10:09:09 -04:00
< div class = "text right actions" >
2023-09-25 04:56:50 -04:00
< button class = "ui cancel button" > {{ ctx .Locale.Tr "settings.cancel" }} </ button >
< button class = "ui red button" > {{ ctx .Locale.Tr "repo.settings.convert_confirm" }} </ button >
2020-07-02 10:09:09 -04:00
< / div >
< / form >
< / div >
2016-03-05 20:45:23 -05:00
< / div >
{{ end }}
2020-07-02 10:09:09 -04:00
{{ if and .Repository.IsFork .Repository.Owner.CanCreateRepo }}
< div class = "ui small modal" id = "convert-fork-repo-modal" >
< div class = "header" >
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.convert_fork" }}
2020-07-02 10:09:09 -04:00
< / div >
< div class = "content" >
2023-05-03 14:32:10 -04:00
< div class = "ui warning message" >
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.convert_fork_notices_1" }}
2020-07-02 10:09:09 -04:00
< / div >
< form class = "ui form" action = " {{ .Link }} " method = "post" >
{{ .CsrfTokenHtml }}
< input type = "hidden" name = "action" value = "convert_fork" >
< div class = "field" >
< label >
2024-01-31 05:20:57 -05:00
{{ ctx .Locale.Tr "repo.settings.enter_repo_name" }}
2023-11-23 14:24:52 -05:00
< span class = "text red" > {{ .Repository.FullName }} </ span >
2020-07-02 10:09:09 -04:00
< / label >
< / div >
< div class = "required field" >
2023-09-25 04:56:50 -04:00
< label for = "repo_name" > {{ ctx .Locale.Tr "repo.repo_name" }} </ label >
2020-07-02 10:09:09 -04:00
< input id = "repo_name" name = "repo_name" required >
< / div >
2016-02-14 15:12:00 -05:00
2020-07-02 10:09:09 -04:00
< div class = "text right actions" >
2023-09-25 04:56:50 -04:00
< button class = "ui cancel button" > {{ ctx .Locale.Tr "settings.cancel" }} </ button >
< button class = "ui red button" > {{ ctx .Locale.Tr "repo.settings.convert_fork_confirm" }} </ button >
2020-07-02 10:09:09 -04:00
< / div >
< / form >
< / div >
< / div >
{{ end }}
2016-03-05 20:45:23 -05:00
< div class = "ui small modal" id = "transfer-repo-modal" >
< div class = "header" >
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.transfer" }}
2015-09-01 06:31:47 -04:00
< / div >
2016-03-05 20:45:23 -05:00
< div class = "content" >
2023-05-03 14:32:10 -04:00
< div class = "ui warning message" >
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.transfer_notices_1" }} < br >
{{ ctx .Locale.Tr "repo.settings.transfer_notices_2" }} < br >
{{ ctx .Locale.Tr "repo.settings.transfer_notices_3" }}
2015-12-07 17:30:52 -05:00
< / div >
2016-03-05 20:45:23 -05:00
< form class = "ui form" action = " {{ .Link }} " method = "post" >
{{ .CsrfTokenHtml }}
< input type = "hidden" name = "action" value = "transfer" >
< div class = "field" >
< label >
2024-01-31 05:20:57 -05:00
{{ ctx .Locale.Tr "repo.settings.enter_repo_name" }}
2023-11-23 14:24:52 -05:00
< span class = "text red" > {{ .Repository.FullName }} </ span >
2016-03-05 20:45:23 -05:00
< / label >
< / div >
< div class = "required field" >
2023-09-25 04:56:50 -04:00
< label for = "repo_name" > {{ ctx .Locale.Tr "repo.repo_name" }} </ label >
2016-03-05 20:45:23 -05:00
< input id = "repo_name" name = "repo_name" required >
< / div >
< div class = "required field" >
2023-09-25 04:56:50 -04:00
< label for = "new_owner_name" > {{ ctx .Locale.Tr "repo.settings.transfer_owner" }} </ label >
2016-03-05 20:45:23 -05:00
< input id = "new_owner_name" name = "new_owner_name" required >
< / div >
2015-12-07 17:30:52 -05:00
2016-03-05 20:45:23 -05:00
< div class = "text right actions" >
2023-09-25 04:56:50 -04:00
< button class = "ui cancel button" > {{ ctx .Locale.Tr "settings.cancel" }} </ button >
< button class = "ui red button" > {{ ctx .Locale.Tr "repo.settings.transfer_perform" }} </ button >
2016-03-05 20:45:23 -05:00
< / div >
< / form >
< / div >
2015-12-07 17:30:52 -05:00
< / div >
2015-08-29 15:21:59 -04:00
2016-03-05 20:45:23 -05:00
< div class = "ui small modal" id = "delete-repo-modal" >
< div class = "header" >
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.delete" }}
2015-12-07 17:30:52 -05:00
< / div >
2016-03-05 20:45:23 -05:00
< div class = "content" >
2023-05-03 14:32:10 -04:00
< div class = "ui warning message" >
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.delete_notices_1" | Safe }} < br >
{{ ctx .Locale.Tr "repo.settings.delete_notices_2" .Repository.FullName | Safe }}
2016-03-05 20:45:23 -05:00
{{ if .Repository.NumForks }} < br >
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.delete_notices_fork_1" }}
2016-03-05 20:45:23 -05:00
{{ end }}
2016-02-14 15:12:00 -05:00
< / div >
2016-03-05 20:45:23 -05:00
< form class = "ui form" action = " {{ .Link }} " method = "post" >
{{ .CsrfTokenHtml }}
< input type = "hidden" name = "action" value = "delete" >
< div class = "field" >
< label >
2024-01-31 05:20:57 -05:00
{{ ctx .Locale.Tr "repo.settings.enter_repo_name" }}
2023-11-23 14:24:52 -05:00
< span class = "text red" > {{ .Repository.FullName }} </ span >
2016-03-05 20:45:23 -05:00
< / label >
< / div >
< div class = "required field" >
2023-12-18 23:40:05 -05:00
< label for = "repo_name_to_delete" > {{ ctx .Locale.Tr "repo.repo_name" }} </ label >
< input id = "repo_name_to_delete" name = "repo_name" required >
2016-03-05 20:45:23 -05:00
< / div >
2015-12-07 17:30:52 -05:00
2016-03-05 20:45:23 -05:00
< div class = "text right actions" >
2023-09-25 04:56:50 -04:00
< button class = "ui cancel button" > {{ ctx .Locale.Tr "settings.cancel" }} </ button >
< button class = "ui red button" > {{ ctx .Locale.Tr "repo.settings.confirm_delete" }} </ button >
2016-03-05 20:45:23 -05:00
< / div >
< / form >
< / div >
2016-02-14 15:12:00 -05:00
< / div >
2016-03-03 15:38:25 -05:00
2022-12-09 21:46:31 -05:00
{{ if .Repository.UnitEnabled $.Context $.UnitTypeWiki }}
2016-03-05 20:45:23 -05:00
< div class = "ui small modal" id = "delete-wiki-modal" >
< div class = "header" >
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.wiki_delete" }}
2016-03-03 15:38:25 -05:00
< / div >
2016-03-05 20:45:23 -05:00
< div class = "content" >
2023-05-03 14:32:10 -04:00
< div class = "ui warning message" >
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.delete_notices_1" | Safe }} < br >
{{ ctx .Locale.Tr "repo.settings.wiki_delete_notices_1" .Repository.Name | Safe }}
2016-03-03 15:38:25 -05:00
< / div >
2016-03-05 20:45:23 -05:00
< form class = "ui form" action = " {{ .Link }} " method = "post" >
{{ .CsrfTokenHtml }}
< input type = "hidden" name = "action" value = "delete-wiki" >
< div class = "field" >
< label >
2024-01-31 05:20:57 -05:00
{{ ctx .Locale.Tr "repo.settings.enter_repo_name" }}
2023-11-23 14:24:52 -05:00
< span class = "text red" > {{ .Repository.FullName }} </ span >
2016-03-05 20:45:23 -05:00
< / label >
< / div >
< div class = "required field" >
2023-09-25 04:56:50 -04:00
< label for = "repo_name" > {{ ctx .Locale.Tr "repo.repo_name" }} </ label >
2016-03-05 20:45:23 -05:00
< input id = "repo_name" name = "repo_name" required >
< / div >
2016-03-03 15:38:25 -05:00
2016-03-05 20:45:23 -05:00
< div class = "text right actions" >
2023-09-25 04:56:50 -04:00
< button class = "ui cancel button" > {{ ctx .Locale.Tr "settings.cancel" }} </ button >
< button class = "ui red button" > {{ ctx .Locale.Tr "repo.settings.confirm_wiki_delete" }} </ button >
2016-03-05 20:45:23 -05:00
< / div >
< / form >
< / div >
2016-03-03 15:38:25 -05:00
< / div >
[GITEA] Allow changing the repo Wiki branch to main
Previously, the repo wiki was hardcoded to use `master` as its branch,
this change makes it possible to use `main` (or something else, governed
by `[repository].DEFAULT_BRANCH`, a setting that already exists and
defaults to `main`).
The way it is done is that a new column is added to the `repository`
table: `wiki_branch`. The migration will make existing repositories
default to `master`, for compatibility's sake, even if they don't have a
Wiki (because it's easier to do that). Newly created repositories will
default to `[repository].DEFAULT_BRANCH` instead.
The Wiki service was updated to use the branch name stored in the
database, and fall back to the default if it is empty.
Old repositories with Wikis using the older `master` branch will have
the option to do a one-time transition to `main`, available via the
repository settings in the "Danger Zone". This option will only be
available for repositories that have the internal wiki enabled, it is
not empty, and the wiki branch is not `[repository].DEFAULT_BRANCH`.
When migrating a repository with a Wiki, Forgejo will use the same
branch name for the wiki as the source repository did. If that's not the
same as the default, the option to normalize it will be available after
the migration's done.
Additionally, the `/api/v1/{owner}/{repo}` endpoint was updated: it will
now include the wiki branch name in `GET` requests, and allow changing
the wiki branch via `PATCH`.
Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit d87c526d2a313fa45093ab49b78bb30322b33298)
2024-01-30 06:18:53 -05:00
{{ if ne $.Repository.GetWikiBranchName .DefaultWikiBranchName }}
< div class = "ui small modal" id = "rename-wiki-branch-modal" >
< div class = "header" >
{{ ctx .Locale.Tr "repo.settings.wiki_rename_branch_main" }}
< / div >
< div class = "content" >
< div class = "ui warning message" >
< ul >
< li > {{ ctx .Locale.Tr "repo.settings.wiki_rename_branch_main_notices_1" | Safe }} </ li >
< li > {{ ctx .Locale.Tr "repo.settings.wiki_rename_branch_main_notices_2" .Repository.Name }} </ li >
< / ul >
< / div >
< form class = "ui form" action = " {{ .Link }} " method = "post" >
{{ .CsrfTokenHtml }}
< input type = "hidden" name = "action" value = "rename-wiki-branch" >
< div class = "field" >
< label >
2024-01-31 05:20:57 -05:00
{{ ctx .Locale.Tr "repo.settings.enter_repo_name" }}
[GITEA] Allow changing the repo Wiki branch to main
Previously, the repo wiki was hardcoded to use `master` as its branch,
this change makes it possible to use `main` (or something else, governed
by `[repository].DEFAULT_BRANCH`, a setting that already exists and
defaults to `main`).
The way it is done is that a new column is added to the `repository`
table: `wiki_branch`. The migration will make existing repositories
default to `master`, for compatibility's sake, even if they don't have a
Wiki (because it's easier to do that). Newly created repositories will
default to `[repository].DEFAULT_BRANCH` instead.
The Wiki service was updated to use the branch name stored in the
database, and fall back to the default if it is empty.
Old repositories with Wikis using the older `master` branch will have
the option to do a one-time transition to `main`, available via the
repository settings in the "Danger Zone". This option will only be
available for repositories that have the internal wiki enabled, it is
not empty, and the wiki branch is not `[repository].DEFAULT_BRANCH`.
When migrating a repository with a Wiki, Forgejo will use the same
branch name for the wiki as the source repository did. If that's not the
same as the default, the option to normalize it will be available after
the migration's done.
Additionally, the `/api/v1/{owner}/{repo}` endpoint was updated: it will
now include the wiki branch name in `GET` requests, and allow changing
the wiki branch via `PATCH`.
Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit d87c526d2a313fa45093ab49b78bb30322b33298)
2024-01-30 06:18:53 -05:00
< span class = "text red" > {{ .Repository.FullName }} </ span >
< / label >
< / div >
< div class = "required field" >
< label for = "repo_name" > {{ ctx .Locale.Tr "repo.repo_name" }} </ label >
< input id = "repo_name" name = "repo_name" required >
< / div >
< div class = "text right actions" >
< button class = "ui cancel button" > {{ ctx .Locale.Tr "settings.cancel" }} </ button >
< button class = "ui red button" > {{ ctx .Locale.Tr "repo.settings.confirm_wiki_branch_rename" }} </ button >
< / div >
< / form >
< / div >
< / div >
{{ end }}
2016-03-05 20:45:23 -05:00
{{ end }}
2019-01-23 13:58:38 -05:00
{{ if not .Repository.IsMirror }}
2023-04-24 07:08:59 -04:00
< div class = "ui g-modal-confirm modal" id = "archive-repo-modal" >
2023-04-23 05:24:19 -04:00
< div class = "header" >
2019-01-23 13:58:38 -05:00
{{ if .Repository.IsArchived }}
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.unarchive.header" }}
2019-01-23 13:58:38 -05:00
{{ else }}
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.archive.header" }}
2019-01-23 13:58:38 -05:00
{{ end }}
< / div >
2023-04-23 05:24:19 -04:00
< div class = "content" >
2023-09-12 19:08:37 -04:00
< div class = "ui warning message" >
2019-01-23 13:58:38 -05:00
{{ if .Repository.IsArchived }}
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.unarchive.text" }}
2019-01-23 13:58:38 -05:00
{{ else }}
2023-09-25 04:56:50 -04:00
{{ ctx .Locale.Tr "repo.settings.archive.text" }}
2019-01-23 13:58:38 -05:00
{{ end }}
2023-09-12 19:08:37 -04:00
< / div >
< form action = " {{ .Link }} " method = "post" >
{{ .CsrfTokenHtml }}
< input type = "hidden" name = "action" value = " {{ if .Repository.IsArchived }} unarchive {{ else }} archive {{ end }} " >
< input type = "hidden" name = "repo_id" value = " {{ .Repository.ID }} " >
< div class = "text right actions" >
< button class = "ui cancel button" > {{ ctx .Locale.Tr "settings.cancel" }} </ button >
< button class = "ui red button" > {{ ctx .Locale.Tr "repo.settings.archive.button" }} </ button >
< / div >
2019-01-23 13:58:38 -05:00
< / form >
2023-09-12 19:08:37 -04:00
< / div >
2019-01-23 13:58:38 -05:00
< / div >
{{ end }}
2016-03-03 23:24:22 -05:00
{{ end }}
2023-08-01 12:00:59 -04:00
{{ template "repo/settings/push_mirror_sync_modal" . }}