fix #128: guard against empty actionName when 'uses: ./' (#130)

* fix #128: guard against empty actionName when 'uses: ./'

* fix #129 - force image name to be lowercase
This commit is contained in:
Casey Lee 2020-03-06 10:17:20 -08:00 committed by GitHub
parent 1f9f3b826e
commit c32a87c6dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -238,7 +238,7 @@ func NewGitCloneExecutor(input NewGitCloneExecutorInput) Executor {
Force: true,
})
if err != nil && err.Error() != "already up-to-date" {
logger.Errorf("Unable to pull %s: %v", refName, err)
logger.Debugf("Unable to pull %s: %v", refName, err)
}
logger.Debugf("Cloned %s to %s", input.URL, input.Dir)

View file

@ -248,7 +248,11 @@ func (sc *StepContext) runAction(actionDir string, actionPath string) common.Exe
containerActionDir = "/actions"
}
log.Debugf("actionDir=%s Workdir=%s ActionCacheDir=%s actionName=%s containerActionDir=%s", actionDir, rc.Config.Workdir, rc.ActionCacheDir(), actionName, containerActionDir)
if actionName == "" {
actionName = filepath.Base(actionDir)
}
log.Debugf("type=%v actionDir=%s Workdir=%s ActionCacheDir=%s actionName=%s containerActionDir=%s", step.Type(), actionDir, rc.Config.Workdir, rc.ActionCacheDir(), actionName, containerActionDir)
switch action.Runs.Using {
case model.ActionRunsUsingNode12:
@ -267,6 +271,7 @@ func (sc *StepContext) runAction(actionDir string, actionPath string) common.Exe
} else {
image = fmt.Sprintf("%s:%s", regexp.MustCompile("[^a-zA-Z0-9]").ReplaceAllString(actionName, "-"), "latest")
image = fmt.Sprintf("act-%s", strings.TrimLeft(image, "-"))
image = strings.ToLower(image)
contextDir := filepath.Join(actionDir, actionPath, action.Runs.Main)
prepImage = container.NewDockerBuildExecutor(container.NewDockerBuildExecutorInput{
ContextDir: contextDir,