@@ -37,13 +37,35 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3737Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
3838exports . installReviewDog = exports . installLint = void 0 ;
3939const core = __importStar ( require ( "@actions/core" ) ) ;
40+ const exec = __importStar ( require ( "@actions/exec" ) ) ;
4041const tc = __importStar ( require ( "@actions/tool-cache" ) ) ;
4142const node_fetch_1 = __importDefault ( require ( "node-fetch" ) ) ;
4243const path_1 = __importDefault ( require ( "path" ) ) ;
4344const releases = 'https://github.com/errata-ai/vale/releases/download' ;
4445const last = 'https://github.com/errata-ai/vale/releases/latest/' ;
46+ function lookupLint ( ) {
47+ return __awaiter ( this , void 0 , void 0 , function * ( ) {
48+ let path = '' ;
49+ let stderr = '' ;
50+ let resp = yield exec . exec ( 'which' , [ 'vale' ] , {
51+ listeners : {
52+ stdout : ( buffer ) => ( path = buffer . toString ( ) . trim ( ) ) ,
53+ stderr : ( data ) => ( stderr += data . toString ( ) )
54+ }
55+ } ) ;
56+ if ( resp !== 0 ) {
57+ core . setFailed ( stderr ) ;
58+ }
59+ core . info ( `Using the install at ${ path } ` ) ;
60+ return path ;
61+ } ) ;
62+ }
4563function installLint ( version ) {
4664 return __awaiter ( this , void 0 , void 0 , function * ( ) {
65+ if ( version === 'none' ) {
66+ core . info ( `Assuming a version of vale is already available.` ) ;
67+ return yield lookupLint ( ) ;
68+ }
4769 core . info ( `Installing Vale version '${ version } ' ...` ) ;
4870 if ( version === 'latest' ) {
4971 const response = yield ( 0 , node_fetch_1 . default ) ( last ) ;
0 commit comments