fix: use new platforms after survey, check working dir for .actrc
(#577)
This commit is contained in:
parent
f5a02581c2
commit
780a8a061c
1 changed files with 8 additions and 9 deletions
17
cmd/root.go
17
cmd/root.go
|
@ -198,11 +198,11 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
|
|||
|
||||
// check platforms
|
||||
if len(input.platforms) == 0 {
|
||||
actrc := []string{
|
||||
filepath.Join(os.Getenv("HOME"), ".actrc"),
|
||||
}
|
||||
_, err = os.Stat(actrc[0])
|
||||
if os.IsNotExist(err) {
|
||||
actrcHome := filepath.Join(os.Getenv("HOME"), ".actrc")
|
||||
actrcCwd := filepath.Join(".", ".actrc")
|
||||
_, errHome := os.Stat(actrcHome)
|
||||
_, errCwd := os.Stat(actrcCwd)
|
||||
if os.IsNotExist(errHome) && os.IsNotExist(errCwd) {
|
||||
var answer string
|
||||
confirmation := &survey.Select{
|
||||
Message: "Please choose the default image you want to use with act:\n\n - Large size image: +20GB Docker image, includes almost all tools used on GitHub Actions (IMPORTANT: currently only ubuntu-18.04 platform is available)\n - Medium size image: ~500MB, includes only necessary tools to bootstrap actions and aims to be compatible with all actions\n - Micro size image: <200MB, contains only NodeJS required to bootstrap actions, doesn't work with all actions\n\nDefault image and other options can be changed manually in ~/.actrc (please refer to https://github.com/nektos/act#configuration for additional information about file structure)",
|
||||
|
@ -210,7 +210,7 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
|
|||
Default: "Medium",
|
||||
Options: []string{"Large", "Medium", "Micro"},
|
||||
}
|
||||
configFileArgs := make([]string, 0)
|
||||
|
||||
err := survey.AskOne(confirmation, &answer)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
|
@ -226,7 +226,7 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
|
|||
option = "-P ubuntu-latest=node:12.20.1-buster-slim\n-P ubuntu-20.04=node:12.20.1-buster-slim\n-P ubuntu-18.04=node:12.20.1-buster-slim\n-P ubuntu-16.04=node:12.20.1-stretch-slim"
|
||||
}
|
||||
|
||||
f, err := os.Create(actrc[0])
|
||||
f, err := os.Create(actrcHome)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -242,8 +242,7 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
|
|||
log.Fatal(err)
|
||||
}
|
||||
|
||||
configFileArgs = append(configFileArgs, readArgsFile(actrc[0])...)
|
||||
cmd.SetArgs(configFileArgs)
|
||||
input.platforms = readArgsFile(actrcHome)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue