Skip to content

Commit

Permalink
fix: panic (nektos#2071)
Browse files Browse the repository at this point in the history
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and mike dupont committed Mar 10, 2024
1 parent 3b1a847 commit e23b155
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions pkg/container/docker_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,22 @@ import (
"strconv"
"strings"

"github.com/go-git/go-billy/v5/helper/polyfill"
"github.com/go-git/go-billy/v5/osfs"
"github.com/go-git/go-git/v5/plumbing/format/gitignore"
"github.com/joho/godotenv"

"github.com/imdario/mergo"
"github.com/kballard/go-shellquote"
"github.com/spf13/pflag"

"github.com/Masterminds/semver"
"github.com/docker/cli/cli/connhelper"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/mount"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/client"
"github.com/docker/docker/pkg/stdcopy"
"github.com/go-git/go-billy/v5/helper/polyfill"
"github.com/go-git/go-billy/v5/osfs"
"github.com/go-git/go-git/v5/plumbing/format/gitignore"
"github.com/imdario/mergo"
"github.com/joho/godotenv"
"github.com/kballard/go-shellquote"
specs "github.com/opencontainers/image-spec/specs-go/v1"

"github.com/Masterminds/semver"
"github.com/spf13/pflag"
"golang.org/x/term"

"github.com/nektos/act/pkg/common"
Expand Down Expand Up @@ -484,11 +481,17 @@ func (cr *containerReference) extractFromImageEnv(env *map[string]string) common
inspect, _, err := cr.cli.ImageInspectWithRaw(ctx, cr.input.Image)
if err != nil {
logger.Error(err)
return fmt.Errorf("inspect image: %w", err)
}

if inspect.Config == nil {
return nil
}

imageEnv, err := godotenv.Unmarshal(strings.Join(inspect.Config.Env, "\n"))
if err != nil {
logger.Error(err)
return fmt.Errorf("unmarshal image env: %w", err)
}

for k, v := range imageEnv {
Expand Down

0 comments on commit e23b155

Please sign in to comment.