mirror of
https://github.com/go-gitea/gitea
synced 2025-07-27 04:38:36 +00:00
Add default bot url
This commit is contained in:
@@ -2478,3 +2478,18 @@ ROUTER = console
|
|||||||
;PROXY_URL =
|
;PROXY_URL =
|
||||||
;; Comma separated list of host names requiring proxy. Glob patterns (*) are accepted; use ** to match all hosts.
|
;; Comma separated list of host names requiring proxy. Glob patterns (*) are accepted; use ** to match all hosts.
|
||||||
;PROXY_HOSTS =
|
;PROXY_HOSTS =
|
||||||
|
|
||||||
|
; [bots]
|
||||||
|
;; Enable/Disable bots capabilities
|
||||||
|
;ENABLED = false
|
||||||
|
;DEFAULT_BOTS_URL = https://gitea.com
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; settings for packages, will override storage setting
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;[storage.bots_log]
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; storage type
|
||||||
|
;STORAGE_TYPE = local
|
||||||
|
@@ -8,21 +8,23 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Builds settings
|
// Bots settings
|
||||||
var (
|
var (
|
||||||
Builds = struct {
|
Bots = struct {
|
||||||
Storage
|
Storage
|
||||||
Enabled bool
|
Enabled bool
|
||||||
|
DefaultBotsURL string
|
||||||
}{
|
}{
|
||||||
Enabled: true,
|
Enabled: false,
|
||||||
|
DefaultBotsURL: "https://gitea.com",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func newBuilds() {
|
func newBuilds() {
|
||||||
sec := Cfg.Section("builds")
|
sec := Cfg.Section("bots")
|
||||||
if err := sec.MapTo(&Builds); err != nil {
|
if err := sec.MapTo(&Bots); err != nil {
|
||||||
log.Fatal("Failed to map Builds settings: %v", err)
|
log.Fatal("Failed to map Builds settings: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
Builds.Storage = getStorage("builds", "", nil)
|
Bots.Storage = getStorage("bots_log", "", nil)
|
||||||
}
|
}
|
@@ -140,7 +140,7 @@ func Init() error {
|
|||||||
initLFS,
|
initLFS,
|
||||||
initRepoArchives,
|
initRepoArchives,
|
||||||
initPackages,
|
initPackages,
|
||||||
initBuilds,
|
initBots,
|
||||||
} {
|
} {
|
||||||
if err := f(); err != nil {
|
if err := f(); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -198,8 +198,8 @@ func initPackages() (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func initBuilds() (err error) {
|
func initBots() (err error) {
|
||||||
log.Info("Initialising Builds storage with type: %s", setting.Builds.Storage.Type)
|
log.Info("Initialising Bots storage with type: %s", setting.Bots.Storage.Type)
|
||||||
Builds, err = NewStorage(setting.Builds.Storage.Type, &setting.Builds.Storage)
|
Builds, err = NewStorage(setting.Bots.Storage.Type, &setting.Bots.Storage)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@@ -18,6 +18,7 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/bots"
|
"code.gitea.io/gitea/modules/bots"
|
||||||
"code.gitea.io/gitea/modules/json"
|
"code.gitea.io/gitea/modules/json"
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
|
"code.gitea.io/gitea/modules/setting"
|
||||||
api "code.gitea.io/gitea/modules/structs"
|
api "code.gitea.io/gitea/modules/structs"
|
||||||
secret_service "code.gitea.io/gitea/services/secrets"
|
secret_service "code.gitea.io/gitea/services/secrets"
|
||||||
|
|
||||||
@@ -321,6 +322,7 @@ func pickTask(ctx context.Context, runner *bots_model.Runner) (*runnerv1.Task, b
|
|||||||
"token": t.Token,
|
"token": t.Token,
|
||||||
"repository_owner": fmt.Sprint(t.Job.Run.Repo.OwnerName),
|
"repository_owner": fmt.Sprint(t.Job.Run.Repo.OwnerName),
|
||||||
"retention_days": "",
|
"retention_days": "",
|
||||||
|
"gitea_default_bots_url": setting.Bots.DefaultBotsURL,
|
||||||
})
|
})
|
||||||
secrets := getSecretsOfTask(ctx, t)
|
secrets := getSecretsOfTask(ctx, t)
|
||||||
if _, ok := secrets["GITHUB_TOKEN"]; !ok {
|
if _, ok := secrets["GITHUB_TOKEN"]; !ok {
|
||||||
|
Reference in New Issue
Block a user