From 934471813a41efabf6a9b5d5b22a2a5770ff12ce Mon Sep 17 00:00:00 2001 From: infinoid Date: Fri, 24 Nov 2023 01:56:27 +0000 Subject: [PATCH] Fix #404: nil map error when reading env file (#405) Co-authored-by: Mark Glines Reviewed-on: https://gitea.com/gitea/act_runner/pulls/405 Reviewed-by: Jason Song Co-authored-by: infinoid Co-committed-by: infinoid --- internal/pkg/config/config.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/pkg/config/config.go b/internal/pkg/config/config.go index 46fd059..084de27 100644 --- a/internal/pkg/config/config.go +++ b/internal/pkg/config/config.go @@ -88,6 +88,9 @@ func LoadDefault(file string) (*Config, error) { if err != nil { return nil, fmt.Errorf("read env file %q: %w", cfg.Runner.EnvFile, err) } + if cfg.Runner.Envs == nil { + cfg.Runner.Envs = map[string]string{} + } for k, v := range envs { cfg.Runner.Envs[k] = v }