use project dir instead of /github/workspace (#567)

This commit is contained in:
rockandska
2021-03-29 06:32:45 +02:00
committed by GitHub
parent 6c258cf40d
commit 6cde8f64dc
4 changed files with 20 additions and 21 deletions

View File

@@ -160,7 +160,7 @@ func (sc *StepContext) setupShellCommand() common.Executor {
}
scriptName := fmt.Sprintf("workflow/%s", step.ID)
log.Debugf("Wrote command '%s' to '%s'", run, scriptName)
containerPath := fmt.Sprintf("/github/%s", scriptName)
containerPath := fmt.Sprintf("%s/%s", filepath.Dir(rc.Config.Workdir), scriptName)
if step.Shell == "" {
step.Shell = rc.Run.Job().Defaults.Run.Shell
@@ -169,7 +169,7 @@ func (sc *StepContext) setupShellCommand() common.Executor {
step.Shell = rc.Run.Workflow.Defaults.Run.Shell
}
sc.Cmd = strings.Fields(strings.Replace(step.ShellCommand(), "{0}", containerPath, 1))
return rc.JobContainer.Copy("/github/", &container.FileEntry{
return rc.JobContainer.Copy(fmt.Sprintf("%s/", filepath.Dir(rc.Config.Workdir)), &container.FileEntry{
Name: scriptName,
Mode: 0755,
Body: script.String(),
@@ -214,7 +214,7 @@ func (sc *StepContext) newStepContainer(ctx context.Context, image string, cmd [
fmt.Sprintf("%s:%s", "/var/run/docker.sock", "/var/run/docker.sock"),
}
if rc.Config.BindWorkdir {
binds = append(binds, fmt.Sprintf("%s:%s%s", rc.Config.Workdir, "/github/workspace", bindModifiers))
binds = append(binds, fmt.Sprintf("%s:%s%s", rc.Config.Workdir, rc.Config.Workdir, bindModifiers))
}
if rc.Config.ContainerArchitecture == "" {
@@ -224,12 +224,12 @@ func (sc *StepContext) newStepContainer(ctx context.Context, image string, cmd [
stepContainer := container.NewContainer(&container.NewContainerInput{
Cmd: cmd,
Entrypoint: entrypoint,
WorkingDir: "/github/workspace",
WorkingDir: rc.Config.Workdir,
Image: image,
Name: createContainerName(rc.jobContainerName(), step.ID),
Env: envList,
Mounts: map[string]string{
rc.jobContainerName(): "/github",
rc.jobContainerName(): filepath.Dir(rc.Config.Workdir),
"act-toolcache": "/toolcache",
"act-actions": "/actions",
},
@@ -299,7 +299,7 @@ func (sc *StepContext) getContainerActionPaths(step *model.Step, actionDir strin
containerActionDir := "."
if step.Type() == model.StepTypeUsesActionLocal {
actionName = getOsSafeRelativePath(actionDir, rc.Config.Workdir)
containerActionDir = "/github/workspace"
containerActionDir = rc.Config.Workdir
} else if step.Type() == model.StepTypeUsesActionRemote {
actionName = getOsSafeRelativePath(actionDir, rc.ActionCacheDir())
containerActionDir = "/actions"