This commit is contained in:
Lunny Xiao
2022-11-25 17:48:33 +08:00
committed by Jason Song
parent b91167b772
commit 7732392a96
16 changed files with 1801 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
package runner
import (
bots_model "code.gitea.io/gitea/models/bots"
"code.gitea.io/gitea/models/webhook"
"code.gitea.io/gitea/modules/git"
)
var runnerTypes = make(map[string]RunnerType)
type RunnerType interface {
Name() string
Detect(commit *git.Commit, event webhook.HookEventType, ref string) (bool, string, error)
Run(task *bots_model.Task) error
}
func RegisterRunnerType(runnerType RunnerType) {
runnerTypes[runnerType.Name()] = runnerType
}
func GetRunnerType(name string) RunnerType {
return runnerTypes[name]
}
func GetRunnerTypes() map[string]RunnerType {
return runnerTypes
}