File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import (
2424 "github.com/nektos/act/pkg/container"
2525 "github.com/nektos/act/pkg/model"
2626 "github.com/nektos/act/pkg/runner"
27+ "gopkg.in/yaml.v3"
2728)
2829
2930// Execute is the entry point to running the CLI
@@ -281,9 +282,26 @@ func parseEnvs(env []string, envs map[string]string) bool {
281282 return false
282283}
283284
285+ func readYamlFile (file string ) (map [string ]string , error ) {
286+ content , err := os .ReadFile (file )
287+ if err != nil {
288+ return nil , err
289+ }
290+ ret := map [string ]string {}
291+ if err = yaml .Unmarshal (content , & ret ); err != nil {
292+ return nil , err
293+ }
294+ return ret , nil
295+ }
296+
284297func readEnvs (path string , envs map [string ]string ) bool {
285298 if _ , err := os .Stat (path ); err == nil {
286- env , err := godotenv .Read (path )
299+ var env map [string ]string
300+ if ext := filepath .Ext (path ); ext == ".yml" || ext == ".yaml" {
301+ env , err = readYamlFile (path )
302+ } else {
303+ env , err = godotenv .Read (path )
304+ }
287305 if err != nil {
288306 log .Fatalf ("Error loading from %s: %v" , path , err )
289307 }
You can’t perform that action at this time.
0 commit comments