@@ -25,7 +25,7 @@ async function main(){
2525
2626 // Get latest version if requested
2727 if ( fpmVersion === 'latest' ) {
28-
28+
2929 if ( token === 'none' ) {
3030 core . setFailed ( 'To fetch the latest fpm version, please supply a github token. Alternatively you can specify the fpm release version manually.' ) ;
3131 }
@@ -48,48 +48,48 @@ async function main(){
4848
4949 console . log ( `This platform is ${ process . platform } ` ) ;
5050 console . log ( `Fetching fpm from ${ fetchPath } ${ filename } ` ) ;
51-
51+
5252 // Download release
5353 var fpmPath ;
5454 try {
55-
55+
5656 fpmPath = await tc . downloadTool ( fetchPath + filename ) ;
57-
57+
5858 } catch ( error ) {
59-
59+
6060 core . setFailed ( `Error while trying to fetch fpm - please check that a version exists at the above release url.` ) ;
61-
61+
6262 }
6363
6464 console . log ( fpmPath ) ;
6565 const downloadDir = path . dirname ( fpmPath ) ;
66-
66+
6767 // Add executable flag on unix
6868 if ( process . platform === 'linux' || process . platform === 'darwin' ) {
69-
69+
7070 await exec . exec ( 'chmod u+x ' + fpmPath ) ;
7171
7272 }
7373
7474 // Rename to 'fpm'
7575 if ( process . platform === 'win32' ) {
76-
76+
7777 await io . mv ( fpmPath , downloadDir + '/' + 'fpm.exe' ) ;
7878
7979 } else {
80-
80+
8181 await io . mv ( fpmPath , downloadDir + '/' + 'fpm' ) ;
8282
8383 }
84-
84+
8585 // Add to path
8686 core . addPath ( downloadDir ) ;
8787 console . log ( `fpm added to path at ${ downloadDir } ` ) ;
88-
88+
8989 } catch ( error ) {
9090
9191 core . setFailed ( error . message ) ;
92-
92+
9393 }
9494} ;
9595
@@ -111,7 +111,7 @@ function getFPMFilename(useHaskell,fpmVersion,platform){
111111 }
112112
113113 filename += fpmVersion . replace ( 'v' , '' ) + '-' ;
114-
114+
115115 if ( platform === 'linux' ) {
116116
117117 filename += 'linux-x86_64' ;
@@ -137,14 +137,14 @@ function getFPMFilename(useHaskell,fpmVersion,platform){
137137// Query github API to find the tag for the latest release
138138//
139139async function getLatestReleaseVersion ( token ) {
140-
140+
141141 const octokit = github . getOctokit ( token ) ;
142-
143- const { data : releases } = await octokit . repos . listReleases ( {
144- owner :'fortran-lang' ,
145- repo :'fpm' } ) ;
146142
147- return releases [ 0 ] . tag_name ;
143+ const { data : latest } = await octokit . request ( 'GET /repos/{owner}/{repo}/releases/latest' , {
144+ owner : 'fortran-lang' ,
145+ repo : 'fpm' } ) ;
146+
147+ return latest . tag_name ;
148148
149149}
150150
0 commit comments