fix: use new platforms after survey, check working dir for .actrc
(#577)
This commit is contained in:
parent
f5a02581c2
commit
780a8a061c
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
|
// check platforms
|
||||||
if len(input.platforms) == 0 {
|
if len(input.platforms) == 0 {
|
||||||
actrc := []string{
|
actrcHome := filepath.Join(os.Getenv("HOME"), ".actrc")
|
||||||
filepath.Join(os.Getenv("HOME"), ".actrc"),
|
actrcCwd := filepath.Join(".", ".actrc")
|
||||||
}
|
_, errHome := os.Stat(actrcHome)
|
||||||
_, err = os.Stat(actrc[0])
|
_, errCwd := os.Stat(actrcCwd)
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(errHome) && os.IsNotExist(errCwd) {
|
||||||
var answer string
|
var answer string
|
||||||
confirmation := &survey.Select{
|
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)",
|
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",
|
Default: "Medium",
|
||||||
Options: []string{"Large", "Medium", "Micro"},
|
Options: []string{"Large", "Medium", "Micro"},
|
||||||
}
|
}
|
||||||
configFileArgs := make([]string, 0)
|
|
||||||
err := survey.AskOne(confirmation, &answer)
|
err := survey.AskOne(confirmation, &answer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
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"
|
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 {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -242,8 +242,7 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
configFileArgs = append(configFileArgs, readArgsFile(actrc[0])...)
|
input.platforms = readArgsFile(actrcHome)
|
||||||
cmd.SetArgs(configFileArgs)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user