mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-18 00:01:32 -04:00
Compare commits
6 Commits
ae8e8f055e
...
24a215e317
Author | SHA1 | Date | |
---|---|---|---|
|
24a215e317 | ||
|
74a5db03fd | ||
|
2814f2fea1 | ||
|
1b1c55f73f | ||
|
fc09c30081 | ||
|
f7c64976d5 |
@ -91,12 +91,6 @@ As a workaround, you can use [go-hashfiles](https://gitea.com/actions/go-hashfil
|
|||||||
|
|
||||||
## Missing features
|
## Missing features
|
||||||
|
|
||||||
### Variables
|
|
||||||
|
|
||||||
See [Variables](https://docs.github.com/en/actions/learn-github-actions/variables).
|
|
||||||
|
|
||||||
It's under development.
|
|
||||||
|
|
||||||
### Problem Matchers
|
### Problem Matchers
|
||||||
|
|
||||||
Problem Matchers are a way to scan the output of actions for a specified regex pattern and surface that information prominently in the UI.
|
Problem Matchers are a way to scan the output of actions for a specified regex pattern and surface that information prominently in the UI.
|
||||||
@ -120,15 +114,17 @@ Pre and Post steps don't have their own section in the job log user interface.
|
|||||||
|
|
||||||
### Downloading actions
|
### Downloading actions
|
||||||
|
|
||||||
Gitea Actions doesn't download actions from GitHub by default.
|
Previously (Pre 1.21.0), `[actions].DEFAULT_ACTIONS_URL` defaulted to `https://gitea.com`.
|
||||||
"By default" means that you don't specify the host in the `uses` field, like `uses: actions/checkout@v3`.
|
We have since restricted this option to only allow two values (`github` and `self`).
|
||||||
As a contrast, `uses: https://github.com/actions/checkout@v3` has specified host.
|
When set to `github`, the new default, Gitea will download non-fully-qualified actions from <https://github.com>.
|
||||||
|
For example, if you use `uses: actions/checkout@v3`, it will download the checkout repository from <https://github.com/actions/checkout.git>.
|
||||||
|
|
||||||
The missing host will be filled with `https://gitea.com` if you don't configure it.
|
If you want to download an action from another git hoster, you can use an absolute URL, e.g. `uses: https://gitea.com/actions/checkout@v3`.
|
||||||
That means `uses: actions/checkout@v3` will download the action from [gitea.com/actions/checkout](https://gitea.com/actions/checkout), instead of [github.com/actions/checkout](https://github.com/actions/checkout).
|
|
||||||
|
|
||||||
As mentioned, it's configurable.
|
If your Gitea instance is in an intranet or a restricted area, you can set the URL to `self` to only download actions from your own instance by default.
|
||||||
If you want your runners to download actions from GitHub or your own Gitea instance by default, you can configure it by setting `[actions].DEFAULT_ACTIONS_URL`. See [Configuration Cheat Sheet](administration/config-cheat-sheet.md#actions-actions).
|
Of course, you can still use absolute URLs in workflows.
|
||||||
|
|
||||||
|
More details about the `[actions].DEFAULT_ACTIONS_URL` configuration can be found in the [Configuration Cheat Sheet](administration/config-cheat-sheet.md#actions-actions)。
|
||||||
|
|
||||||
### Context availability
|
### Context availability
|
||||||
|
|
||||||
|
@ -120,15 +120,13 @@ Gitea Actions目前不支持此功能。
|
|||||||
|
|
||||||
### 下载Actions
|
### 下载Actions
|
||||||
|
|
||||||
Gitea Actions默认不从GitHub下载Actions。
|
当 `[actions].DEFAULT_ACTIONS_URL` 保持默认值为 `github` 时,Gitea将会从 https://github.com 下载相对路径的actions。比如:
|
||||||
"默认" 意味着您在`uses` 字段中不指定主机,如`uses: actions/checkout@v3`。
|
如果你使用 `uses: actions/checkout@v3`,Gitea将会从 https://github.com/actions/checkout.git 下载这个 actions 项目。
|
||||||
相反,`uses: https://github.com/actions/checkout@v3`是有指定主机的。
|
如果你想要从另外一个 Git服务下载actions,你只需要使用绝对URL `uses: https://gitea.com/actions/checkout@v3` 来下载。
|
||||||
|
|
||||||
如果您不进行配置,缺失的主机将填充为`https://gitea.com`。
|
如果你的 Gitea 实例是部署在一个互联网限制的网络中,有可以使用绝对地址来下载 actions。你也可以讲配置项修改为 `[actions].DEFAULT_ACTIONS_URL = self`。这样所有的相对路径的actions引用,将不再会从 github.com 去下载,而会从这个 Gitea 实例自己的仓库中去下载。例如: `uses: actions/checkout@v3` 将会从 `[server].ROOT_URL`/actions/checkout.git 这个地址去下载 actions。
|
||||||
这意味着`uses: actions/checkout@v3`将从[gitea.com/actions/checkout](https://gitea.com/actions/checkout)下载该Action,而不是[github.com/actions/checkout](https://github.com/actions/checkout)。
|
|
||||||
|
|
||||||
正如前面提到的,这是可配置的。
|
设置`[actions].DEFAULT_ACTIONS_URL`进行配置。请参阅[配置备忘单](administration/config-cheat-sheet.md#actions-actions)。
|
||||||
如果您希望您的运行程序默认从GitHub或您自己的Gitea实例下载动作,您可以通过设置`[actions].DEFAULT_ACTIONS_URL`进行配置。请参阅[配置备忘单](administration/config-cheat-sheet.md#actions-actions)。
|
|
||||||
|
|
||||||
### 上下文可用性
|
### 上下文可用性
|
||||||
|
|
||||||
|
@ -77,8 +77,9 @@ func userProfile(ctx *context.Context) {
|
|||||||
|
|
||||||
func prepareUserProfileTabData(ctx *context.Context, showPrivate bool, profileGitRepo *git.Repository, profileReadme *git.Blob) {
|
func prepareUserProfileTabData(ctx *context.Context, showPrivate bool, profileGitRepo *git.Repository, profileReadme *git.Blob) {
|
||||||
// if there is a profile readme, default to "overview" page, otherwise, default to "repositories" page
|
// if there is a profile readme, default to "overview" page, otherwise, default to "repositories" page
|
||||||
|
// if there is not a profile readme, the overview tab should be treated as the repositories tab
|
||||||
tab := ctx.FormString("tab")
|
tab := ctx.FormString("tab")
|
||||||
if tab == "" {
|
if tab == "" || tab == "overview" {
|
||||||
if profileReadme != nil {
|
if profileReadme != nil {
|
||||||
tab = "overview"
|
tab = "overview"
|
||||||
} else {
|
} else {
|
||||||
@ -157,10 +158,10 @@ func prepareUserProfileTabData(ctx *context.Context, showPrivate bool, profileGi
|
|||||||
switch tab {
|
switch tab {
|
||||||
case "followers":
|
case "followers":
|
||||||
ctx.Data["Cards"] = followers
|
ctx.Data["Cards"] = followers
|
||||||
total = int(count)
|
total = int(numFollowers)
|
||||||
case "following":
|
case "following":
|
||||||
ctx.Data["Cards"] = following
|
ctx.Data["Cards"] = following
|
||||||
total = int(count)
|
total = int(numFollowing)
|
||||||
case "activity":
|
case "activity":
|
||||||
date := ctx.FormString("date")
|
date := ctx.FormString("date")
|
||||||
pagingNum = setting.UI.FeedPagingNum
|
pagingNum = setting.UI.FeedPagingNum
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
type Provider interface {
|
type Provider interface {
|
||||||
Name() string
|
Name() string
|
||||||
DisplayName() string
|
DisplayName() string
|
||||||
IconHTML() template.HTML
|
IconHTML(size int) template.HTML
|
||||||
CustomURLSettings() *CustomURLSettings
|
CustomURLSettings() *CustomURLSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,14 +54,16 @@ func (p *AuthSourceProvider) DisplayName() string {
|
|||||||
return p.sourceName
|
return p.sourceName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *AuthSourceProvider) IconHTML() template.HTML {
|
func (p *AuthSourceProvider) IconHTML(size int) template.HTML {
|
||||||
if p.iconURL != "" {
|
if p.iconURL != "" {
|
||||||
img := fmt.Sprintf(`<img class="gt-object-contain gt-mr-3" width="20" height="20" src="%s" alt="%s">`,
|
img := fmt.Sprintf(`<img class="gt-object-contain gt-mr-3" width="%d" height="%d" src="%s" alt="%s">`,
|
||||||
|
size,
|
||||||
|
size,
|
||||||
html.EscapeString(p.iconURL), html.EscapeString(p.DisplayName()),
|
html.EscapeString(p.iconURL), html.EscapeString(p.DisplayName()),
|
||||||
)
|
)
|
||||||
return template.HTML(img)
|
return template.HTML(img)
|
||||||
}
|
}
|
||||||
return p.GothProvider.IconHTML()
|
return p.GothProvider.IconHTML(size)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Providers contains the map of registered OAuth2 providers in Gitea (based on goth)
|
// Providers contains the map of registered OAuth2 providers in Gitea (based on goth)
|
||||||
|
@ -27,7 +27,7 @@ func (b *BaseProvider) DisplayName() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// IconHTML returns icon HTML for this provider
|
// IconHTML returns icon HTML for this provider
|
||||||
func (b *BaseProvider) IconHTML() template.HTML {
|
func (b *BaseProvider) IconHTML(size int) template.HTML {
|
||||||
svgName := "gitea-" + b.name
|
svgName := "gitea-" + b.name
|
||||||
switch b.name {
|
switch b.name {
|
||||||
case "gplus":
|
case "gplus":
|
||||||
@ -35,10 +35,10 @@ func (b *BaseProvider) IconHTML() template.HTML {
|
|||||||
case "github":
|
case "github":
|
||||||
svgName = "octicon-mark-github"
|
svgName = "octicon-mark-github"
|
||||||
}
|
}
|
||||||
svgHTML := svg.RenderHTML(svgName, 20, "gt-mr-3")
|
svgHTML := svg.RenderHTML(svgName, size, "gt-mr-3")
|
||||||
if svgHTML == "" {
|
if svgHTML == "" {
|
||||||
log.Error("No SVG icon for oauth2 provider %q", b.name)
|
log.Error("No SVG icon for oauth2 provider %q", b.name)
|
||||||
svgHTML = svg.RenderHTML("gitea-openid", 20, "gt-mr-3")
|
svgHTML = svg.RenderHTML("gitea-openid", size, "gt-mr-3")
|
||||||
}
|
}
|
||||||
return svgHTML
|
return svgHTML
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,8 @@ func (o *OpenIDProvider) DisplayName() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// IconHTML returns icon HTML for this provider
|
// IconHTML returns icon HTML for this provider
|
||||||
func (o *OpenIDProvider) IconHTML() template.HTML {
|
func (o *OpenIDProvider) IconHTML(size int) template.HTML {
|
||||||
return svg.RenderHTML("gitea-openid", 20, "gt-mr-3")
|
return svg.RenderHTML("gitea-openid", size, "gt-mr-3")
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateGothProvider creates a GothProvider from this Provider
|
// CreateGothProvider creates a GothProvider from this Provider
|
||||||
|
@ -168,7 +168,9 @@ func TestRepository_AddWikiPage(t *testing.T) {
|
|||||||
assert.NoError(t, AddWikiPage(git.DefaultContext, doer, repo, webPath, wikiContent, commitMsg))
|
assert.NoError(t, AddWikiPage(git.DefaultContext, doer, repo, webPath, wikiContent, commitMsg))
|
||||||
// Now need to show that the page has been added:
|
// Now need to show that the page has been added:
|
||||||
gitRepo, err := git.OpenRepository(git.DefaultContext, repo.WikiPath())
|
gitRepo, err := git.OpenRepository(git.DefaultContext, repo.WikiPath())
|
||||||
assert.NoError(t, err)
|
if !assert.NoError(t, err) {
|
||||||
|
return
|
||||||
|
}
|
||||||
defer gitRepo.Close()
|
defer gitRepo.Close()
|
||||||
masterTree, err := gitRepo.GetTree(DefaultBranch)
|
masterTree, err := gitRepo.GetTree(DefaultBranch)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
@ -238,7 +240,9 @@ func TestRepository_DeleteWikiPage(t *testing.T) {
|
|||||||
|
|
||||||
// Now need to show that the page has been added:
|
// Now need to show that the page has been added:
|
||||||
gitRepo, err := git.OpenRepository(git.DefaultContext, repo.WikiPath())
|
gitRepo, err := git.OpenRepository(git.DefaultContext, repo.WikiPath())
|
||||||
assert.NoError(t, err)
|
if !assert.NoError(t, err) {
|
||||||
|
return
|
||||||
|
}
|
||||||
defer gitRepo.Close()
|
defer gitRepo.Close()
|
||||||
masterTree, err := gitRepo.GetTree(DefaultBranch)
|
masterTree, err := gitRepo.GetTree(DefaultBranch)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
@ -251,8 +255,10 @@ func TestPrepareWikiFileName(t *testing.T) {
|
|||||||
unittest.PrepareTestEnv(t)
|
unittest.PrepareTestEnv(t)
|
||||||
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
|
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
|
||||||
gitRepo, err := git.OpenRepository(git.DefaultContext, repo.WikiPath())
|
gitRepo, err := git.OpenRepository(git.DefaultContext, repo.WikiPath())
|
||||||
|
if !assert.NoError(t, err) {
|
||||||
|
return
|
||||||
|
}
|
||||||
defer gitRepo.Close()
|
defer gitRepo.Close()
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
@ -303,8 +309,10 @@ func TestPrepareWikiFileName_FirstPage(t *testing.T) {
|
|||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
gitRepo, err := git.OpenRepository(git.DefaultContext, tmpDir)
|
gitRepo, err := git.OpenRepository(git.DefaultContext, tmpDir)
|
||||||
|
if !assert.NoError(t, err) {
|
||||||
|
return
|
||||||
|
}
|
||||||
defer gitRepo.Close()
|
defer gitRepo.Close()
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
existence, newWikiPath, err := prepareGitPath(gitRepo, "Home")
|
existence, newWikiPath, err := prepareGitPath(gitRepo, "Home")
|
||||||
assert.False(t, existence)
|
assert.False(t, existence)
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
{{range $key := .OrderedOAuth2Names}}
|
{{range $key := .OrderedOAuth2Names}}
|
||||||
{{$provider := index $.OAuth2Providers $key}}
|
{{$provider := index $.OAuth2Providers $key}}
|
||||||
<a class="{{$provider.Name}} ui button gt-df gt-ac gt-jc gt-py-3 oauth-login-link" href="{{AppSubUrl}}/user/oauth2/{{$key}}">
|
<a class="{{$provider.Name}} ui button gt-df gt-ac gt-jc gt-py-3 oauth-login-link" href="{{AppSubUrl}}/user/oauth2/{{$key}}">
|
||||||
{{$provider.IconHTML}}
|
{{$provider.IconHTML 28}}
|
||||||
{{$.locale.Tr "sign_in_with_provider" $provider.DisplayName}}
|
{{$.locale.Tr "sign_in_with_provider" $provider.DisplayName}}
|
||||||
</a>
|
</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -66,7 +66,7 @@
|
|||||||
{{range $key := .OrderedOAuth2Names}}
|
{{range $key := .OrderedOAuth2Names}}
|
||||||
{{$provider := index $.OAuth2Providers $key}}
|
{{$provider := index $.OAuth2Providers $key}}
|
||||||
<a class="{{$provider.Name}} ui button gt-df gt-ac gt-jc gt-py-3 oauth-login-link" href="{{AppSubUrl}}/user/oauth2/{{$key}}">
|
<a class="{{$provider.Name}} ui button gt-df gt-ac gt-jc gt-py-3 oauth-login-link" href="{{AppSubUrl}}/user/oauth2/{{$key}}">
|
||||||
{{$provider.IconHTML}}
|
{{$provider.IconHTML 28}}
|
||||||
{{$.locale.Tr "sign_in_with_provider" $provider.DisplayName}}
|
{{$.locale.Tr "sign_in_with_provider" $provider.DisplayName}}
|
||||||
</a>
|
</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
{{range $key := .OrderedOAuth2Names}}
|
{{range $key := .OrderedOAuth2Names}}
|
||||||
{{$provider := index $.OAuth2Providers $key}}
|
{{$provider := index $.OAuth2Providers $key}}
|
||||||
<a class="item" href="{{AppSubUrl}}/user/oauth2/{{$key}}">
|
<a class="item" href="{{AppSubUrl}}/user/oauth2/{{$key}}">
|
||||||
{{$provider.IconHTML}}
|
{{$provider.IconHTML 20}}
|
||||||
{{$provider.DisplayName}}
|
{{$provider.DisplayName}}
|
||||||
</a>
|
</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user