mirror of
https://github.com/go-gitea/gitea.git
synced 2026-01-18 23:01:44 +01:00
Merge 065af3a4123751e1831bd673d8c4eb83e199981f into fafd1db19e3aae98a92fb3a5673f34e389a26e4b
This commit is contained in:
commit
aa8ae2eafe
@ -7,8 +7,6 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
)
|
||||
|
||||
// Actions settings
|
||||
@ -41,8 +39,7 @@ func (url defaultActionsURL) URL() string {
|
||||
case defaultActionsURLSelf:
|
||||
return strings.TrimSuffix(AppURL, "/")
|
||||
default:
|
||||
// This should never happen, but just in case, use GitHub as fallback
|
||||
return "https://github.com"
|
||||
return strings.Split(string(url), ",")[0]
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,11 +76,9 @@ func loadActionsFrom(rootCfg ConfigProvider) error {
|
||||
if urls := string(Actions.DefaultActionsURL); urls != defaultActionsURLGitHub && urls != defaultActionsURLSelf {
|
||||
url := strings.Split(urls, ",")[0]
|
||||
if strings.HasPrefix(url, "https://") || strings.HasPrefix(url, "http://") {
|
||||
log.Error("[actions] DEFAULT_ACTIONS_URL does not support %q as custom URL any longer, fallback to %q",
|
||||
urls,
|
||||
defaultActionsURLGitHub,
|
||||
)
|
||||
Actions.DefaultActionsURL = defaultActionsURLGitHub
|
||||
// Users may want to define their own default actions URL, e.g. "https://github.com" or a self-hosted mirror.
|
||||
// So we should not force the fallback to "github" (defaultActionsURLGitHub) here.
|
||||
// The user should ensure the URL is valid and accessible.
|
||||
} else {
|
||||
return fmt.Errorf("unsupported [actions] DEFAULT_ACTIONS_URL: %q", urls)
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ DEFAULT_ACTIONS_URL = self
|
||||
DEFAULT_ACTIONS_URL = https://gitea.com
|
||||
`,
|
||||
wantErr: assert.NoError,
|
||||
wantURL: "https://github.com",
|
||||
wantURL: "https://gitea.com",
|
||||
},
|
||||
{
|
||||
name: "custom urls",
|
||||
@ -155,7 +155,7 @@ DEFAULT_ACTIONS_URL = https://gitea.com
|
||||
DEFAULT_ACTIONS_URL = https://gitea.com,https://github.com
|
||||
`,
|
||||
wantErr: assert.NoError,
|
||||
wantURL: "https://github.com",
|
||||
wantURL: "https://gitea.com",
|
||||
},
|
||||
{
|
||||
name: "invalid",
|
||||
@ -164,7 +164,7 @@ DEFAULT_ACTIONS_URL = https://gitea.com,https://github.com
|
||||
DEFAULT_ACTIONS_URL = gitea
|
||||
`,
|
||||
wantErr: assert.Error,
|
||||
wantURL: "https://github.com",
|
||||
wantURL: "gitea",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user