Skip to content
This repository was archived by the owner on Dec 19, 2025. It is now read-only.

Commit 7ee8645

Browse files
author
Axel Rindle
committed
Fixed response object is not an array when fetching latest release only
1 parent 89c169d commit 7ee8645

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

lib/main.coffee

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ check = (options, callback) ->
2727

2828
# do the api call
2929
apiUrl = sprintf baseApiUrl, repo
30-
if includePreReleases then apiUrl += '/latest'
30+
if not includePreReleases then apiUrl += '/latest'
3131
got(apiUrl).then((response) ->
3232
# parse the response body into an object
3333
releases = JSON.parse response.body
@@ -45,11 +45,10 @@ check = (options, callback) ->
4545
callback release, null
4646
break
4747
else
48-
latest = releases[0]
49-
tag = latest.tag_name.replace(/[^0-9$.,]/g, '')
48+
tag = releases.tag_name.replace(/[^0-9$.,]/g, '')
5049
if semcmp(currentVersion, tag) is -1
5150
found = true
52-
callback latest, null
51+
callback releases, null
5352

5453
callback(null, null) if not found
5554
).catch((error) ->

0 commit comments

Comments
 (0)