Fix failed to create container if the runner works in root dir (#67)

Fix #56

This PR uses the `preset.Repository` as a part of the workdir and use `filepath.FromSlash` to convert the slash characters.

Co-authored-by: Jason Song <i@wolfogre.com>
Reviewed-on: https://gitea.com/gitea/act_runner/pulls/67
Reviewed-by: Jason Song <i@wolfogre.com>
Co-authored-by: Zettat123 <zettat123@gmail.com>
Co-committed-by: Zettat123 <zettat123@gmail.com>
pull/25/head
Zettat123 2023-03-23 09:41:22 +08:00 committed by Jason Song
parent 9f90cba993
commit 8f81f40d62
1 changed files with 3 additions and 1 deletions

View File

@ -212,7 +212,9 @@ func (t *Task) Run(ctx context.Context, task *runnerv1.Task, runnerName, runnerV
input := t.Input
config := &runner.Config{
Workdir: "." + string(filepath.Separator),
// On Linux, Workdir will be like "/<owner>/<repo>"
// On Windows, Workdir will be like "\<owner>\<repo>"
Workdir: filepath.FromSlash(string(filepath.Separator) + preset.Repository),
BindWorkdir: false,
ReuseContainers: false,
ForcePull: input.forcePull,