github.1485827954.workers.dev/nektos/act@v0.2.63/cmd/input.go (about) 1 package cmd 2 3 import ( 4 "path/filepath" 5 6 log "github.com/sirupsen/logrus" 7 ) 8 9 // Input contains the input for the root command 10 type Input struct { 11 actor string 12 workdir string 13 workflowsPath string 14 autodetectEvent bool 15 eventPath string 16 reuseContainers bool 17 bindWorkdir bool 18 secrets []string 19 vars []string 20 envs []string 21 inputs []string 22 platforms []string 23 dryrun bool 24 forcePull bool 25 forceRebuild bool 26 noOutput bool 27 envfile string 28 inputfile string 29 secretfile string 30 varfile string 31 insecureSecrets bool 32 defaultBranch string 33 privileged bool 34 usernsMode string 35 containerArchitecture string 36 containerDaemonSocket string 37 containerOptions string 38 noWorkflowRecurse bool 39 useGitIgnore bool 40 githubInstance string 41 containerCapAdd []string 42 containerCapDrop []string 43 autoRemove bool 44 artifactServerPath string 45 artifactServerAddr string 46 artifactServerPort string 47 noCacheServer bool 48 cacheServerPath string 49 cacheServerAddr string 50 cacheServerPort uint16 51 jsonLogger bool 52 noSkipCheckout bool 53 remoteName string 54 replaceGheActionWithGithubCom []string 55 replaceGheActionTokenWithGithubCom string 56 matrix []string 57 actionCachePath string 58 actionOfflineMode bool 59 logPrefixJobID bool 60 networkName string 61 useNewActionCache bool 62 localRepository []string 63 } 64 65 func (i *Input) resolve(path string) string { 66 basedir, err := filepath.Abs(i.workdir) 67 if err != nil { 68 log.Fatal(err) 69 } 70 if path == "" { 71 return path 72 } 73 if !filepath.IsAbs(path) { 74 path = filepath.Join(basedir, path) 75 } 76 return path 77 } 78 79 // Envfile returns path to .env 80 func (i *Input) Envfile() string { 81 return i.resolve(i.envfile) 82 } 83 84 // Secretfile returns path to secrets 85 func (i *Input) Secretfile() string { 86 return i.resolve(i.secretfile) 87 } 88 89 func (i *Input) Varfile() string { 90 return i.resolve(i.varfile) 91 } 92 93 // Workdir returns path to workdir 94 func (i *Input) Workdir() string { 95 return i.resolve(".") 96 } 97 98 // WorkflowsPath returns path to workflow file(s) 99 func (i *Input) WorkflowsPath() string { 100 return i.resolve(i.workflowsPath) 101 } 102 103 // EventPath returns the path to events file 104 func (i *Input) EventPath() string { 105 return i.resolve(i.eventPath) 106 } 107 108 // Inputfile returns the path to the input file 109 func (i *Input) Inputfile() string { 110 return i.resolve(i.inputfile) 111 }