diff --git a/actions/action.go b/actions/action.go index 79162e9..3913341 100644 --- a/actions/action.go +++ b/actions/action.go @@ -7,6 +7,7 @@ import ( "os" "path/filepath" "regexp" + "strings" "github.com/nektos/act/common" log "github.com/sirupsen/logrus" @@ -14,9 +15,10 @@ import ( // imageURL is the directory where a `Dockerfile` should exist func parseImageLocal(workingDir string, contextDir string) (contextDirOut string, tag string, ok bool) { - if !filepath.IsAbs(contextDir) { - contextDir = filepath.Join(workingDir, contextDir) + if !strings.HasPrefix(contextDir, "./") { + return "", "", false } + contextDir = filepath.Join(workingDir, contextDir) if _, err := os.Stat(filepath.Join(contextDir, "Dockerfile")); os.IsNotExist(err) { log.Debugf("Ignoring missing Dockerfile '%s/Dockerfile'", contextDir) return "", "", false diff --git a/actions/runner_test.go b/actions/runner_test.go index 890eca1..bd1d31e 100644 --- a/actions/runner_test.go +++ b/actions/runner_test.go @@ -43,7 +43,8 @@ func TestParseImageLocal(t *testing.T) { }{ {"docker://myhost.com/foo/bar", "", "", false}, {"http://google.com:8080", "", "", false}, - {"example/action1", "/example/action1", "action1:", true}, + {"example/action1", "", "", false}, + {"./example/action1", "/example/action1", "action1:", true}, } revision, _, err := common.FindGitRevision(".")