@@ -137,17 +137,7 @@ async function runLint(binPath: string, patchPath: string): Promise<void> {
137
137
cmdArgs . cwd = path . resolve ( workingDirectory )
138
138
}
139
139
140
- if ( core . getBooleanInput ( `verify` , { required : true } ) ) {
141
- let cmdVerify = `${ binPath } config verify`
142
- if ( userArgsMap . get ( "config" ) ) {
143
- cmdVerify += ` --config=${ userArgsMap . get ( "config" ) } `
144
- }
145
-
146
- core . info ( `Running [${ cmdVerify } ] in [${ cmdArgs . cwd || process . cwd ( ) } ] ...` )
147
-
148
- const res = await execShellCommand ( cmdVerify , cmdArgs )
149
- printOutput ( res )
150
- }
140
+ await runVerify ( binPath , userArgsMap , cmdArgs )
151
141
152
142
const cmd = `${ binPath } run ${ addedArgs . join ( ` ` ) } ${ userArgs } ` . trimEnd ( )
153
143
@@ -173,6 +163,44 @@ async function runLint(binPath: string, patchPath: string): Promise<void> {
173
163
core . info ( `Ran golangci-lint in ${ Date . now ( ) - startedAt } ms` )
174
164
}
175
165
166
+ async function runVerify ( binPath : string , userArgsMap : Map < string , string > , cmdArgs : ExecOptions ) : Promise < void > {
167
+ const verify = core . getBooleanInput ( `verify` , { required : true } )
168
+ if ( ! verify ) {
169
+ return
170
+ }
171
+
172
+ const cfgPath = await getConfigPath ( binPath , userArgsMap , cmdArgs )
173
+ if ( ! cfgPath ) {
174
+ return
175
+ }
176
+
177
+ let cmdVerify = `${ binPath } config verify`
178
+ if ( userArgsMap . get ( "config" ) ) {
179
+ cmdVerify += ` --config=${ userArgsMap . get ( "config" ) } `
180
+ }
181
+
182
+ core . info ( `Running [${ cmdVerify } ] in [${ cmdArgs . cwd || process . cwd ( ) } ] ...` )
183
+
184
+ const res = await execShellCommand ( cmdVerify , cmdArgs )
185
+ printOutput ( res )
186
+ }
187
+
188
+ async function getConfigPath ( binPath : string , userArgsMap : Map < string , string > , cmdArgs : ExecOptions ) : Promise < string > {
189
+ let cmdConfigPath = `${ binPath } config path`
190
+ if ( userArgsMap . get ( "config" ) ) {
191
+ cmdConfigPath += ` --config=${ userArgsMap . get ( "config" ) } `
192
+ }
193
+
194
+ core . info ( `Running [${ cmdConfigPath } ] in [${ cmdArgs . cwd || process . cwd ( ) } ] ...` )
195
+
196
+ try {
197
+ const resPath = await execShellCommand ( cmdConfigPath , cmdArgs )
198
+ return resPath . stderr . trim ( )
199
+ } catch {
200
+ return ``
201
+ }
202
+ }
203
+
176
204
export async function run ( ) : Promise < void > {
177
205
try {
178
206
const { binPath, patchPath } = await core . group ( `prepare environment` , prepareEnv )
0 commit comments