fix 22: require prefix './' for local actions
This commit is contained in:
parent
320e9b6057
commit
ca268132b9
2 changed files with 6 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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(".")
|
||||
|
|
Loading…
Reference in a new issue