Skip to content

Commit

Permalink
fix #128: guard against empty actionName when 'uses: ./' (#130)
Browse files Browse the repository at this point in the history
* fix #128: guard against empty actionName when 'uses: ./'

* fix #129 - force image name to be lowercase
  • Loading branch information
cplee authored Mar 6, 2020
1 parent 1f9f3b8 commit c32a87c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/common/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
7 changes: 6 additions & 1 deletion pkg/runner/step_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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,
Expand Down

0 comments on commit c32a87c

Please sign in to comment.