-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.go
More file actions
33 lines (30 loc) · 704 Bytes
/
utils.go
File metadata and controls
33 lines (30 loc) · 704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package githubactionsrunnerlauncher
import (
"errors"
"os"
"path/filepath"
)
// GetWorkDirForRunner ...
func (l *Launcher) GetWorkDirForRunner(runner RunnerConfig) (string, error) {
wd := runner.Environment.RunnerWorkdir
if wd == "" {
return "", errors.New("missing workdir for runner")
}
if filepath.IsAbs(wd) {
return wd, nil
}
// Combine relative with base
if l.configPath == "" {
return "", errors.New("missing config dir to obtain runner workdir")
}
return filepath.Join(l.configPath, wd), nil
}
func fileExists(path string) (bool, error) {
_, err := os.Stat(path)
if os.IsNotExist(err) {
return false, nil
} else if err != nil {
return false, err
}
return true, nil
}