1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-09-30 19:22:09 +00:00

initial load of yaml working

This commit is contained in:
Casey Lee 2020-02-04 16:38:41 -08:00
parent 113ebda3ff
commit fbab49c68d
28 changed files with 522 additions and 393 deletions

40
cmd/input.go Normal file
View file

@ -0,0 +1,40 @@
package cmd
import (
"log"
"path/filepath"
)
// Input contains the input for the root command
type Input struct {
workingDir string
workflowsPath string
eventPath string
reuseContainers bool
dryrun bool
forcePull bool
}
func (i *Input) resolve(path string) string {
basedir, err := filepath.Abs(i.workingDir)
if err != nil {
log.Fatal(err)
}
if path == "" {
return path
}
if !filepath.IsAbs(path) {
path = filepath.Join(basedir, path)
}
return path
}
// WorkflowsPath returns path to workflows
func (i *Input) WorkflowsPath() string {
return i.resolve(i.workflowsPath)
}
// EventPath returns the path to events file
func (i *Input) EventPath() string {
return i.resolve(i.eventPath)
}