Skip to content

Commit 6791833

Browse files
committed
fix: panic
1 parent c93462e commit 6791833

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

pkg/container/docker_run.go

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,25 @@ import (
1616
"strconv"
1717
"strings"
1818

19-
"github.com/docker/docker/api/types/network"
20-
networktypes "github.com/docker/docker/api/types/network"
21-
"github.com/gobwas/glob"
22-
23-
"github.com/go-git/go-billy/v5/helper/polyfill"
24-
"github.com/go-git/go-billy/v5/osfs"
25-
"github.com/go-git/go-git/v5/plumbing/format/gitignore"
26-
"github.com/joho/godotenv"
27-
28-
"github.com/imdario/mergo"
29-
"github.com/kballard/go-shellquote"
30-
"github.com/spf13/pflag"
31-
19+
"github.com/Masterminds/semver"
3220
"github.com/docker/cli/cli/compose/loader"
3321
"github.com/docker/cli/cli/connhelper"
3422
"github.com/docker/docker/api/types"
3523
"github.com/docker/docker/api/types/container"
3624
"github.com/docker/docker/api/types/mount"
25+
"github.com/docker/docker/api/types/network"
26+
networktypes "github.com/docker/docker/api/types/network"
3727
"github.com/docker/docker/client"
3828
"github.com/docker/docker/pkg/stdcopy"
29+
"github.com/go-git/go-billy/v5/helper/polyfill"
30+
"github.com/go-git/go-billy/v5/osfs"
31+
"github.com/go-git/go-git/v5/plumbing/format/gitignore"
32+
"github.com/gobwas/glob"
33+
"github.com/imdario/mergo"
34+
"github.com/joho/godotenv"
35+
"github.com/kballard/go-shellquote"
3936
specs "github.com/opencontainers/image-spec/specs-go/v1"
40-
41-
"github.com/Masterminds/semver"
37+
"github.com/spf13/pflag"
4238
"golang.org/x/term"
4339

4440
"github.com/nektos/act/pkg/common"
@@ -523,11 +519,17 @@ func (cr *containerReference) extractFromImageEnv(env *map[string]string) common
523519
inspect, _, err := cr.cli.ImageInspectWithRaw(ctx, cr.input.Image)
524520
if err != nil {
525521
logger.Error(err)
522+
return fmt.Errorf("inspect image: %w", err)
523+
}
524+
525+
if inspect.Config == nil {
526+
return nil
526527
}
527528

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

533535
for k, v := range imageEnv {

0 commit comments

Comments
 (0)