a5e86bd024
This adds the `-a` flag when running `act` to change the username of the GITHUB_ACTOR environment variable Co-authored-by: Casey Lee <cplee@nektos.com>
62 lines
1.2 KiB
Go
62 lines
1.2 KiB
Go
package cmd
|
|
|
|
import (
|
|
"log"
|
|
"path/filepath"
|
|
)
|
|
|
|
// Input contains the input for the root command
|
|
type Input struct {
|
|
actor string
|
|
workdir string
|
|
workflowsPath string
|
|
eventPath string
|
|
reuseContainers bool
|
|
bindWorkdir bool
|
|
secrets []string
|
|
platforms []string
|
|
dryrun bool
|
|
forcePull bool
|
|
noOutput bool
|
|
envfile string
|
|
secretfile string
|
|
}
|
|
|
|
func (i *Input) resolve(path string) string {
|
|
basedir, err := filepath.Abs(i.workdir)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
if path == "" {
|
|
return path
|
|
}
|
|
if !filepath.IsAbs(path) {
|
|
path = filepath.Join(basedir, path)
|
|
}
|
|
return path
|
|
}
|
|
|
|
// Envfile returns path to .env
|
|
func (i *Input) Envfile() string {
|
|
return i.resolve(i.envfile)
|
|
}
|
|
|
|
// Secretfile returns path to secrets
|
|
func (i *Input) Secretfile() string {
|
|
return i.resolve(i.secretfile)
|
|
}
|
|
|
|
// Workdir returns path to workdir
|
|
func (i *Input) Workdir() string {
|
|
return i.resolve(".")
|
|
}
|
|
|
|
// 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)
|
|
}
|