@@ -137,17 +137,7 @@ async function runLint(binPath: string, patchPath: string): Promise<void> {
137137 cmdArgs . cwd = path . resolve ( workingDirectory )
138138 }
139139
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 )
151141
152142 const cmd = `${ binPath } run ${ addedArgs . join ( ` ` ) } ${ userArgs } ` . trimEnd ( )
153143
@@ -173,6 +163,44 @@ async function runLint(binPath: string, patchPath: string): Promise<void> {
173163 core . info ( `Ran golangci-lint in ${ Date . now ( ) - startedAt } ms` )
174164}
175165
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+
176204export async function run ( ) : Promise < void > {
177205 try {
178206 const { binPath, patchPath } = await core . group ( `prepare environment` , prepareEnv )
0 commit comments