github.com/nektos/act@v0.2.83/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 cacheServerExternalURL string 50 cacheServerAddr string 51 cacheServerPort uint16 52 jsonLogger bool 53 noSkipCheckout bool 54 remoteName string 55 replaceGheActionWithGithubCom []string 56 replaceGheActionTokenWithGithubCom string 57 matrix []string 58 actionCachePath string 59 actionOfflineMode bool 60 logPrefixJobID bool 61 networkName string 62 useNewActionCache bool 63 localRepository []string 64 listOptions bool 65 validate bool 66 strict bool 67 concurrentJobs int 68 } 69 70 func (i *Input) resolve(path string) string { 71 basedir, err := filepath.Abs(i.workdir) 72 if err != nil { 73 log.Fatal(err) 74 } 75 if path == "" { 76 return path 77 } 78 if !filepath.IsAbs(path) { 79 path = filepath.Join(basedir, path) 80 } 81 return path 82 } 83 84 // Envfile returns path to .env 85 func (i *Input) Envfile() string { 86 return i.resolve(i.envfile) 87 } 88 89 // Secretfile returns path to secrets 90 func (i *Input) Secretfile() string { 91 return i.resolve(i.secretfile) 92 } 93 94 func (i *Input) Varfile() string { 95 return i.resolve(i.varfile) 96 } 97 98 // Workdir returns path to workdir 99 func (i *Input) Workdir() string { 100 return i.resolve(".") 101 } 102 103 // WorkflowsPath returns path to workflow file(s) 104 func (i *Input) WorkflowsPath() string { 105 return i.resolve(i.workflowsPath) 106 } 107 108 // EventPath returns the path to events file 109 func (i *Input) EventPath() string { 110 return i.resolve(i.eventPath) 111 } 112 113 // Inputfile returns the path to the input file 114 func (i *Input) Inputfile() string { 115 return i.resolve(i.inputfile) 116 }