@@ -972,20 +972,23 @@ const fs = __importStar(__webpack_require__(747));
972
972
const path = __importStar ( __webpack_require__ ( 622 ) ) ;
973
973
async function getLatestRdflintVersion ( ) {
974
974
const response = await node_fetch_1 . default ( 'https://jitpack.io/api/builds/com.github.imas/rdflint/latestOk' ) ;
975
+ if ( ! response . ok ) {
976
+ throw new Error ( `Failed to get the latest rdflint version: ${ response . status } ${ response . statusText } ` ) ;
977
+ }
975
978
const { version } = await response . json ( ) ;
976
979
if ( typeof version !== 'string' ) {
977
- throw new Error ( 'Failed to get the latest rdflint version' ) ;
980
+ throw new Error ( 'Failed to get the latest rdflint version: Unexpected version format ' ) ;
978
981
}
979
982
return version ;
980
983
}
981
984
async function installRdflint ( version ) {
982
985
const downloadUrl = `https://jitpack.io/com/github/imas/rdflint/${ version } /rdflint-${ version } .jar` ;
983
986
const downloadPath = await tc . downloadTool ( downloadUrl ) ;
984
987
const cachePath = await tc . cacheFile ( downloadPath , 'rdflint.jar' , 'rdflint' , version ) ;
988
+ const jarPath = path . join ( cachePath , 'rdflint.jar' ) ;
985
989
const executablePath = path . join ( cachePath , 'rdflint' ) ;
986
- fs . writeFileSync ( executablePath , `#!/bin/sh\njava -jar ${ cachePath } /rdflint.jar $@` ) ;
990
+ fs . writeFileSync ( executablePath , `#!/bin/sh\njava -jar ${ jarPath } $@` ) ;
987
991
fs . chmodSync ( executablePath , 0o555 ) ;
988
- core . addPath ( cachePath ) ;
989
992
return cachePath ;
990
993
}
991
994
async function run ( ) {
@@ -999,6 +1002,7 @@ async function run() {
999
1002
console . log ( 'Installing rdflint ' + version ) ;
1000
1003
rdflintPath = await installRdflint ( version ) ;
1001
1004
}
1005
+ core . addPath ( rdflintPath ) ;
1002
1006
}
1003
1007
catch ( e ) {
1004
1008
core . setFailed ( e . message ) ;
0 commit comments