@@ -17,7 +17,6 @@ import (
17
17
var environ = os .Environ ()
18
18
19
19
type GithubActionConfig struct {
20
- Dir string
21
20
Config string
22
21
GoogleApplicationCredentials string
23
22
googleApplicationCredentialsData string
@@ -26,25 +25,14 @@ type GithubActionConfig struct {
26
25
func ReadGithubActionConfig () (* GithubActionConfig , error ) {
27
26
c := & GithubActionConfig {}
28
27
29
- c .Dir = os .Getenv ("INPUT_DIR" )
30
- if c .Dir == "" {
31
- wd , err := os .Getwd ()
32
- if err != nil {
33
- return nil , err
34
- }
35
- c .Dir = wd
36
- }
37
-
38
28
c .Config = os .Getenv ("INPUT_CONFIG" )
39
29
if c .Config == "" {
40
- c .Config = filepath .Join (c .Dir , "deploy.yml" )
41
- } else {
42
- c .Config = filepath .Join (c .Dir , c .Config )
30
+ c .Config = "deploy.yml"
43
31
}
44
32
45
33
// read Google Application Credentials if this is a path
46
34
c .GoogleApplicationCredentials = os .Getenv ("INPUT_GOOGLE_APPLICATION_CREDENTIALS" )
47
- f , err := ioutil .ReadFile (filepath . Join ( c . Dir , c . GoogleApplicationCredentials ) )
35
+ f , err := ioutil .ReadFile (c . GoogleApplicationCredentials )
48
36
if err == nil {
49
37
c .googleApplicationCredentialsData = string (f )
50
38
} else {
@@ -100,7 +88,7 @@ type Deploy struct {
100
88
Tags []string `yaml:"tags"`
101
89
}
102
90
103
- func ParseConfig (workingDir string , b io.Reader ) (* Config , error ) {
91
+ func ParseConfig (b io.Reader ) (* Config , error ) {
104
92
c := & Config {}
105
93
d := yaml .NewDecoder (b )
106
94
d .SetStrict (true )
@@ -125,7 +113,7 @@ func ParseConfig(workingDir string, b io.Reader) (*Config, error) {
125
113
126
114
dy .GoogleApplicationCredentials = expandShellRe (dy .GoogleApplicationCredentials , getEnv (nil ))
127
115
128
- f , err := ioutil .ReadFile (filepath . Join ( workingDir , dy .GoogleApplicationCredentials ) )
116
+ f , err := ioutil .ReadFile (dy .GoogleApplicationCredentials )
129
117
if err == nil {
130
118
dy .googleApplicationCredentialsData = string (f )
131
119
} else {
@@ -180,23 +168,23 @@ func ParseConfig(workingDir string, b io.Reader) (*Config, error) {
180
168
dy := & c .Deploys [i ]
181
169
182
170
if dy .StartupScriptPath != "" {
183
- f , err := ioutil .ReadFile (filepath . Join ( workingDir , dy .StartupScriptPath ) )
171
+ f , err := ioutil .ReadFile (dy .StartupScriptPath )
184
172
if err != nil {
185
173
return nil , fmt .Errorf ("startup_script: %v" , err )
186
174
}
187
175
dy .startupScript = expandMakeRe (string (f ), getEnv (dy .Vars ))
188
176
}
189
177
190
178
if dy .ShutdownScriptPath != "" {
191
- f , err := ioutil .ReadFile (filepath . Join ( workingDir , dy .ShutdownScriptPath ) )
179
+ f , err := ioutil .ReadFile (dy .ShutdownScriptPath )
192
180
if err != nil {
193
181
return nil , fmt .Errorf ("shutdown_script: %v" , err )
194
182
}
195
183
dy .shutdownScript = expandMakeRe (string (f ), getEnv (dy .Vars ))
196
184
}
197
185
198
186
if dy .CloudInitPath != "" {
199
- f , err := ioutil .ReadFile (filepath . Join ( workingDir , dy .CloudInitPath ) )
187
+ f , err := ioutil .ReadFile (dy .CloudInitPath )
200
188
if err != nil {
201
189
return nil , fmt .Errorf ("cloud_init: %v" , err )
202
190
}
0 commit comments