@@ -2352,6 +2352,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
2352
2352
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
2353
2353
const core = __importStar ( __webpack_require__ ( 470 ) ) ;
2354
2354
const child_process_1 = __webpack_require__ ( 129 ) ;
2355
+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
2356
+ const path = __importStar ( __webpack_require__ ( 622 ) ) ;
2355
2357
const util_1 = __webpack_require__ ( 669 ) ;
2356
2358
const cache_1 = __webpack_require__ ( 722 ) ;
2357
2359
const install_1 = __webpack_require__ ( 655 ) ;
@@ -2396,11 +2398,19 @@ function runLint(lintPath) {
2396
2398
if ( args . includes ( `-out-format` ) ) {
2397
2399
throw new Error ( `please, don't change out-format for golangci-lint: it can be broken in a future` ) ;
2398
2400
}
2401
+ const workingDirectory = core . getInput ( `working-directory` ) ;
2402
+ const cmdArgs = { } ;
2403
+ if ( workingDirectory != `` ) {
2404
+ if ( ! fs . existsSync ( workingDirectory ) || ! fs . lstatSync ( workingDirectory ) . isDirectory ( ) ) {
2405
+ throw new Error ( `working-directory (${ workingDirectory } ) was not a path` ) ;
2406
+ }
2407
+ cmdArgs . cwd = path . resolve ( workingDirectory ) ;
2408
+ }
2399
2409
const cmd = `${ lintPath } run --out-format=github-actions ${ args } ` . trimRight ( ) ;
2400
- core . info ( `Running [${ cmd } ] ...` ) ;
2410
+ core . info ( `Running [${ cmd } ] in [ ${ cmdArgs . cwd } ] ...` ) ;
2401
2411
const startedAt = Date . now ( ) ;
2402
2412
try {
2403
- const res = yield execShellCommand ( cmd ) ;
2413
+ const res = yield execShellCommand ( cmd , cmdArgs ) ;
2404
2414
printOutput ( res ) ;
2405
2415
core . info ( `golangci-lint found no issues` ) ;
2406
2416
}
0 commit comments